add ldap support | simplify authentications

This commit is contained in:
guillaume 2018-10-09 14:14:39 +02:00
parent 5b8c642d8f
commit 3b4f285fea
15 changed files with 493 additions and 49 deletions

View file

@ -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();
},
});
});