diff options
author | Lauri Ojansivu <x@xet7.org> | 2018-11-17 16:50:42 +0200 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2018-11-17 16:50:42 +0200 |
commit | aa691b0af105c8dbc5443b1e0823a701e53c3871 (patch) | |
tree | 7f76c9e79c6da428d85160ea9108d586a0e560f8 /client/components/settings | |
parent | 7a75d821147c7d9e2ad48b212348c4bf2d4db063 (diff) | |
download | wekan-aa691b0af105c8dbc5443b1e0823a701e53c3871.tar.gz wekan-aa691b0af105c8dbc5443b1e0823a701e53c3871.tar.bz2 wekan-aa691b0af105c8dbc5443b1e0823a701e53c3871.zip |
- Revert Improve authentication to [fix Login failure](https://github.com/wekan/wekan/issues/2004).
Thanks to xet7 !
Closes #2004
Diffstat (limited to 'client/components/settings')
-rw-r--r-- | client/components/settings/connectionMethod.jade | 6 | ||||
-rw-r--r-- | client/components/settings/connectionMethod.js | 34 |
2 files changed, 40 insertions, 0 deletions
diff --git a/client/components/settings/connectionMethod.jade b/client/components/settings/connectionMethod.jade new file mode 100644 index 00000000..ac4c8c64 --- /dev/null +++ b/client/components/settings/connectionMethod.jade @@ -0,0 +1,6 @@ +template(name='connectionMethod') + 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 new file mode 100644 index 00000000..9fe8f382 --- /dev/null +++ b/client/components/settings/connectionMethod.js @@ -0,0 +1,34 @@ +Template.connectionMethod.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]})), + ]); + } + + // If only the default authentication available, hides the select boxe + const content = $('.at-form-authentication'); + if (!(this.authenticationMethods.get().length > 1)) { + content.hide(); + } else { + content.show(); + } + }); +}); + +Template.connectionMethod.onRendered(() => { + // Moves the select boxe in the first place of the at-pwd-form div + $('.at-form-authentication').detach().prependTo('.at-pwd-form'); +}); + +Template.connectionMethod.helpers({ + authentications() { + return Template.instance().authenticationMethods.get(); + }, +}); |