diff options
author | guillaume <guillaume.cassou@supinfo.com> | 2018-10-09 14:14:39 +0200 |
---|---|---|
committer | guillaume <guillaume.cassou@supinfo.com> | 2018-10-09 14:14:39 +0200 |
commit | 3b4f285fea4a90ee96bfce855e1539adcec9b7aa (patch) | |
tree | 61cbf1212c8d4052cf2bd3c37a497f1d8b204140 /client/components/settings | |
parent | 5b8c642d8fb16e00000a1d92bcd3a5c6bbd07bce (diff) | |
download | wekan-3b4f285fea4a90ee96bfce855e1539adcec9b7aa.tar.gz wekan-3b4f285fea4a90ee96bfce855e1539adcec9b7aa.tar.bz2 wekan-3b4f285fea4a90ee96bfce855e1539adcec9b7aa.zip |
add ldap support | simplify authentications
Diffstat (limited to 'client/components/settings')
-rw-r--r-- | client/components/settings/connectionMethod.jade | 8 | ||||
-rw-r--r-- | client/components/settings/connectionMethod.js | 22 | ||||
-rw-r--r-- | client/components/settings/peopleBody.jade | 22 | ||||
-rw-r--r-- | client/components/settings/peopleBody.js | 31 |
4 files changed, 65 insertions, 18 deletions
diff --git a/client/components/settings/connectionMethod.jade b/client/components/settings/connectionMethod.jade index 598dd9dd..ac4c8c64 100644 --- a/client/components/settings/connectionMethod.jade +++ b/client/components/settings/connectionMethod.jade @@ -1,6 +1,6 @@ template(name='connectionMethod') - div.at-form-connection - label Authentication method - select.select-connection - each connections + div.at-form-authentication + label {{_ 'authentication-method'}} + select.select-authentication + each authentications option(value="{{value}}") {{_ value}} diff --git a/client/components/settings/connectionMethod.js b/client/components/settings/connectionMethod.js index 4983a3ef..3d5cfd76 100644 --- a/client/components/settings/connectionMethod.js +++ b/client/components/settings/connectionMethod.js @@ -1,20 +1,20 @@ Template.connectionMethod.onCreated(function() { - this.connectionMethods = new ReactiveVar([]); + this.authenticationMethods = new ReactiveVar([]); - Meteor.call('getConnectionsEnabled', (_, result) => { + Meteor.call('getAuthenticationsEnabled', (_, result) => { if (result) { // TODO : add a management of different languages // (ex {value: ldap, text: TAPi18n.__('ldap', {}, T9n.getLanguage() || 'en')}) - this.connectionMethods.set([ - {value: 'default'}, - // Gets only the connection methods availables + this.authenticationMethods.set([ + {value: 'password'}, + // Gets only the authentication methods availables ...Object.entries(result).filter((e) => e[1]).map((e) => ({value: e[0]})), ]); } // If only the default authentication available, hides the select boxe - const content = $('.at-form-connection'); - if (!(this.connectionMethods.get().length > 1)) { + const content = $('.at-form-authentication'); + if (!(this.authenticationMethods.get().length > 1)) { content.hide(); } else { content.show(); @@ -24,11 +24,11 @@ Template.connectionMethod.onCreated(function() { Template.connectionMethod.onRendered(() => { // Moves the select boxe in the first place of the at-pwd-form div - $('.at-form-connection').detach().prependTo('.at-pwd-form'); + $('.at-form-authentication').detach().prependTo('.at-pwd-form'); }); Template.connectionMethod.helpers({ - connections() { - return Template.instance().connectionMethods.get(); + authentications() { + return Template.instance().authenticationMethods.get(); }, -}); +});
\ No newline at end of file diff --git a/client/components/settings/peopleBody.jade b/client/components/settings/peopleBody.jade index a3506a24..4d06637e 100644 --- a/client/components/settings/peopleBody.jade +++ b/client/components/settings/peopleBody.jade @@ -27,6 +27,7 @@ template(name="peopleGeneral") th {{_ 'verified'}} th {{_ 'createdAt'}} th {{_ 'active'}} + th {{_ 'authentication-method'}} th each user in peopleList +peopleRow(userId=user._id) @@ -52,6 +53,7 @@ template(name="peopleRow") | {{_ 'no'}} else | {{_ 'yes'}} + td {{_ userData.authenticationMethod }} td a.edit-user | {{_ 'edit'}} @@ -66,12 +68,18 @@ template(name="editUserPopup") | {{_ 'username'}} span.error.hide.username-taken | {{_ 'error-username-taken'}} - input.js-profile-username(type="text" value=user.username) + if isLdap + input.js-profile-username(type="text" value=user.username readonly) + else + input.js-profile-username(type="text" value=user.username) label | {{_ 'email'}} span.error.hide.email-taken | {{_ 'error-email-taken'}} - input.js-profile-email(type="email" value="{{user.emails.[0].address}}") + if isLdap + input.js-profile-email(type="email" value="{{user.emails.[0].address}}" readonly) + else + input.js-profile-email(type="email" value="{{user.emails.[0].address}}") label | {{_ 'admin'}} select.select-role.js-profile-isadmin @@ -82,9 +90,17 @@ template(name="editUserPopup") select.select-active.js-profile-isactive option(value="false") {{_ 'yes'}} option(value="true" selected="{{user.loginDisabled}}") {{_ 'no'}} + label + | {{_ 'authentication-type'}} + select.select-authenticationMethod.js-authenticationMethod + each authentications + if isSelected value + option(value="{{value}}" selected) {{_ value}} + else + option(value="{{value}}") {{_ value}} hr label | {{_ 'password'}} input.js-profile-password(type="password") - input.primary.wide(type="submit" value="{{_ 'save'}}") + input.primary.wide(type="submit" value="{{_ 'save'}}")
\ No newline at end of file diff --git a/client/components/settings/peopleBody.js b/client/components/settings/peopleBody.js index 7cc992f2..acc94081 100644 --- a/client/components/settings/peopleBody.js +++ b/client/components/settings/peopleBody.js @@ -62,10 +62,39 @@ Template.peopleRow.helpers({ }, }); +Template.editUserPopup.onCreated(function() { + this.authenticationMethods = new ReactiveVar([]); + + Meteor.call('getAuthenticationsEnabled', (_, result) => { + if (result) { + // 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]})), + ]); + } + }); +}); + Template.editUserPopup.helpers({ user() { return Users.findOne(this.userId); }, + authentications() { + return Template.instance().authenticationMethods.get(); + }, + isSelected(match) { + const userId = Template.instance().data.userId; + const selected = Users.findOne(userId).authenticationMethod; + return selected === match; + }, + isLdap() { + const userId = Template.instance().data.userId; + const selected = Users.findOne(userId).authenticationMethod; + return selected === 'ldap'; + } }); BlazeComponent.extendComponent({ @@ -91,6 +120,7 @@ Template.editUserPopup.events({ const isAdmin = tpl.find('.js-profile-isadmin').value.trim(); const isActive = tpl.find('.js-profile-isactive').value.trim(); const email = tpl.find('.js-profile-email').value.trim(); + const authentication = tpl.find('.js-authenticationMethod').value.trim(); const isChangePassword = password.length > 0; const isChangeUserName = username !== user.username; @@ -101,6 +131,7 @@ Template.editUserPopup.events({ 'profile.fullname': fullname, 'isAdmin': isAdmin === 'true', 'loginDisabled': isActive === 'true', + 'authenticationMethod': authentication }, }); |