Merge pull request #5056 from cloudron-io/login-layout-fixes-2

Login layout fixes 2
This commit is contained in:
Lauri Ojansivu 2023-08-03 18:38:29 +03:00 committed by GitHub
commit 7d1bca3702
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 14 deletions

View file

@ -35,6 +35,13 @@ Template.userFormsLayout.onCreated(function () {
Meteor.loginWithOidc(options);
}
});
Meteor.subscribe('setting', {
onReady() {
templateInstance.currentSetting.set(ReactiveCache.getCurrentSetting());
return this.stop();
},
});
}
});
@ -52,10 +59,6 @@ Template.userFormsLayout.onRendered(() => {
if (result) {
$('.at-pwd-form').show();
}
if (result && enabledAuthenticationMethods.length > 1) {
$('.at-sep').show();
}
});
Meteor.call('isDisableRegistration', (_, result) => {

View file

@ -3,22 +3,18 @@ Template.connectionMethod.onCreated(function() {
Meteor.call('getAuthenticationsEnabled', (_, result) => {
if (result) {
// Only enabled auth methods without OAuth2/OpenID which is a separate button
const tmp = Object.keys(result).filter((k) => result[k]).filter((k) => k !== 'oauth2');
// 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] })),
]);
this.authenticationMethods.set([{ value: 'password' }].concat(tmp.map((k) => { return { value: k }; })));
}
// If only the default authentication available, hides the select boxe
const content = $('.at-form-authentication');
// OAuth method is a separate button, so ignore it in the count
const formAuthenticationMethods = this.authenticationMethods.get().filter((method) => method.value !== 'oauth2');
if (formAuthenticationMethods > 1) {
if (this.authenticationMethods.get().length > 1) {
content.show();
} else {
content.hide();