diff options
Diffstat (limited to 'client/components/settings/connectionMethod.js')
-rw-r--r-- | client/components/settings/connectionMethod.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/client/components/settings/connectionMethod.js b/client/components/settings/connectionMethod.js new file mode 100644 index 00000000..4983a3ef --- /dev/null +++ b/client/components/settings/connectionMethod.js @@ -0,0 +1,34 @@ +Template.connectionMethod.onCreated(function() { + this.connectionMethods = new ReactiveVar([]); + + Meteor.call('getConnectionsEnabled', (_, 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 + ...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)) { + content.hide(); + } else { + content.show(); + } + }); +}); + +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'); +}); + +Template.connectionMethod.helpers({ + connections() { + return Template.instance().connectionMethods.get(); + }, +}); |