瀏覽代碼

Fix lint errors.

Lauri Ojansivu 6 年之前
父節點
當前提交
3a7ae7c5f2

+ 3 - 3
client/components/main/layouts.js

@@ -7,7 +7,7 @@ const i18nTagToT9n = (i18nTag) => {
 };
 
 const validator = {
-  set: function(obj, prop, value) {
+  set(obj, prop, value) {
     if (prop === 'state' && value !== 'signIn') {
       $('.at-form-authentication').hide();
     } else if (prop === 'state' && value === 'signIn') {
@@ -17,7 +17,7 @@ const validator = {
     obj[prop] = value;
     // Indicate success
     return true;
-  }
+  },
 };
 
 Template.userFormsLayout.onRendered(() => {
@@ -82,7 +82,7 @@ Template.userFormsLayout.events({
     });
   },
   'click #at-btn'(event) {
-    /* All authentication method can be managed/called here. 
+    /* All authentication method can be managed/called here.
        !! DON'T FORGET to correctly fill the fields of the user during its creation if necessary authenticationMethod : String !!
     */
     const authenticationMethodSelected = $('.select-authentication').val();

+ 1 - 1
client/components/settings/connectionMethod.js

@@ -31,4 +31,4 @@ Template.connectionMethod.helpers({
   authentications() {
     return Template.instance().authenticationMethods.get();
   },
-});
+});

+ 4 - 4
client/components/settings/peopleBody.js

@@ -67,12 +67,12 @@ Template.editUserPopup.onCreated(function() {
 
   Meteor.call('getAuthenticationsEnabled', (_, result) => {
     if (result) {
-      // TODO : add a management of different languages 
+      // TODO : add a management of different languages
       // (ex {value: ldap, text: TAPi18n.__('ldap', {}, T9n.getLanguage() || 'en')})
       this.authenticationMethods.set([
         {value: 'password'},
         // Gets only the authentication methods availables
-        ...Object.entries(result).filter(e => e[1]).map(e => ({value: e[0]})),
+        ...Object.entries(result).filter((e) => e[1]).map((e) => ({value: e[0]})),
       ]);
     }
   });
@@ -94,7 +94,7 @@ Template.editUserPopup.helpers({
     const userId = Template.instance().data.userId;
     const selected = Users.findOne(userId).authenticationMethod;
     return selected === 'ldap';
-  }
+  },
 });
 
 BlazeComponent.extendComponent({
@@ -131,7 +131,7 @@ Template.editUserPopup.events({
         'profile.fullname': fullname,
         'isAdmin': isAdmin === 'true',
         'loginDisabled': isActive === 'true',
-        'authenticationMethod': authentication
+        'authenticationMethod': authentication,
       },
     });
 

+ 4 - 4
models/users.js

@@ -499,7 +499,7 @@ if (Meteor.isServer) {
       user.emails = [{ address: email, verified: true }];
       const initials = user.services.oidc.fullname.match(/\b[a-zA-Z]/g).join('').toUpperCase();
       user.profile = { initials, fullname: user.services.oidc.fullname };
-      user['authenticationMethod'] = 'oauth2';
+      user.authenticationMethod = 'oauth2';
 
       // see if any existing user has this email address or username, otherwise create new
       const existingUser = Meteor.users.findOne({$or: [{'emails.address': email}, {'username':user.username}]});
@@ -512,7 +512,7 @@ if (Meteor.isServer) {
       existingUser.emails = user.emails;
       existingUser.username = user.username;
       existingUser.profile = user.profile;
-      existingUser['authenticationMethod'] = user['authenticationMethod'];
+      existingUser.authenticationMethod = user.authenticationMethod;
 
       Meteor.users.remove({_id: existingUser._id}); // remove existing record
       return existingUser;
@@ -527,7 +527,7 @@ if (Meteor.isServer) {
     // If ldap, bypass the inviation code if the self registration isn't allowed.
     // TODO : pay attention if ldap field in the user model change to another content ex : ldap field to connection_type
     if (options.ldap || !disableRegistration) {
-      user['authenticationMethod'] = 'ldap';
+      user.authenticationMethod = 'ldap';
       return user;
     }
 
@@ -647,7 +647,7 @@ if (Meteor.isServer) {
     const disableRegistration = Settings.findOne().disableRegistration;
     // If ldap, bypass the inviation code if the self registration isn't allowed.
     // TODO : pay attention if ldap field in the user model change to another content ex : ldap field to connection_type
-    if (doc['authenticationMethod'] !== 'ldap' && disableRegistration) {
+    if (doc.authenticationMethod !== 'ldap' && disableRegistration) {
       const invitationCode = InvitationCodes.findOne({code: doc.profile.icode, valid: true});
       if (!invitationCode) {
         throw new Meteor.Error('error-invitation-code-not-exist');

+ 1 - 1
server/publications/people.js

@@ -17,7 +17,7 @@ Meteor.publish('people', function(limit) {
         'emails': 1,
         'createdAt': 1,
         'loginDisabled': 1,
-        'authenticationMethod': 1
+        'authenticationMethod': 1,
       },
     });
   } else {