From c502ab95009fc5814f1b96b45c6503313551578d Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Mon, 24 Dec 2018 18:18:41 +0200 Subject: - Revert "Improve authentication" and "Default Authentication Method" to make login work again. - Fixes to docker-compose.yml so that Wekan Meteor 1.6.x version would work. Most likely Meteor 1.8.x version is still broken. Thanks to xet7 ! --- client/components/settings/connectionMethod.jade | 6 +++++ client/components/settings/connectionMethod.js | 34 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 client/components/settings/connectionMethod.jade create mode 100644 client/components/settings/connectionMethod.js (limited to 'client/components/settings') 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(); + }, +}); -- cgit v1.2.3-1-g7c22