Selaa lähdekoodia

Merge branch 'reactify/personal-settings' into reactify/create-component-for-manage-external-account

itizawa 6 vuotta sitten
vanhempi
sitoutus
96cdc6b127

+ 2 - 3
src/client/js/services/PersonalContainer.js

@@ -22,7 +22,7 @@ export default class PersonalContainer extends Container {
       retrieveError: null,
       retrieveError: null,
       name: '',
       name: '',
       email: '',
       email: '',
-      registrationWhiteList: [],
+      registrationWhiteList: this.appContainer.getConfig().registrationWhiteList,
       isEmailPublished: false,
       isEmailPublished: false,
       lang: 'en-US',
       lang: 'en-US',
       externalAccounts: [],
       externalAccounts: [],
@@ -43,12 +43,11 @@ export default class PersonalContainer extends Container {
   async retrievePersonalData() {
   async retrievePersonalData() {
     try {
     try {
       const response = await this.appContainer.apiv3.get('/personal-setting/');
       const response = await this.appContainer.apiv3.get('/personal-setting/');
-      const { currentUser, registrationWhiteList } = response.data.personalParams;
+      const { currentUser } = response.data;
 
 
       this.setState({
       this.setState({
         name: currentUser.name,
         name: currentUser.name,
         email: currentUser.email,
         email: currentUser.email,
-        registrationWhiteList,
         isEmailPublished: currentUser.isEmailPublished,
         isEmailPublished: currentUser.isEmailPublished,
         lang: currentUser.lang,
         lang: currentUser.lang,
       });
       });

+ 1 - 0
src/server/models/config.js

@@ -179,6 +179,7 @@ module.exports = function(crowi) {
         image: crowi.fileUploadService.getIsUploadable(),
         image: crowi.fileUploadService.getIsUploadable(),
         file: crowi.fileUploadService.getFileUploadEnabled(),
         file: crowi.fileUploadService.getFileUploadEnabled(),
       },
       },
+      registrationWhiteList: crowi.configManager.getConfig('crowi', 'security:registrationWhiteList'),
       behaviorType: crowi.configManager.getConfig('crowi', 'customize:behavior'),
       behaviorType: crowi.configManager.getConfig('crowi', 'customize:behavior'),
       layoutType: crowi.configManager.getConfig('crowi', 'customize:layout'),
       layoutType: crowi.configManager.getConfig('crowi', 'customize:layout'),
       themeType: crowi.configManager.getConfig('crowi', 'customize:theme'),
       themeType: crowi.configManager.getConfig('crowi', 'customize:theme'),

+ 3 - 6
src/server/routes/apiv3/personal-setting.js

@@ -42,16 +42,13 @@ module.exports = (crowi) => {
    *              application/json:
    *              application/json:
    *                schema:
    *                schema:
    *                  properties:
    *                  properties:
-   *                    personalParams:
+   *                    currentUser:
    *                      type: object
    *                      type: object
    *                      description: personal params
    *                      description: personal params
    */
    */
   router.get('/', loginRequiredStrictly, async(req, res) => {
   router.get('/', loginRequiredStrictly, async(req, res) => {
-    const personalParams = {
-      currentUser: await User.findUserByUsername(req.user.username),
-      registrationWhiteList: await crowi.configManager.getConfig('crowi', 'security:registrationWhiteList'),
-    };
-    return res.apiv3({ personalParams });
+    const currentUser = await User.findUserByUsername(req.user.username);
+    return res.apiv3({ currentUser });
   });
   });
 
 
   // TODO swagger
   // TODO swagger