Avoid further UI flickering on load and show/hide OR in login screen if more than one is active

Fixes #5028
This commit is contained in:
Johannes Zellner 2023-08-01 12:57:25 +02:00
parent d17d12e719
commit 1271409989
3 changed files with 23 additions and 14 deletions

View file

@ -16,11 +16,27 @@ Template.connectionMethod.onCreated(function() {
// If only the default authentication available, hides the select boxe
const content = $('.at-form-authentication');
if (!(this.authenticationMethods.get().length > 1)) {
content.hide();
} else {
// 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) {
content.show();
} else {
content.hide();
}
if (this.authenticationMethods.get().some((method) => method.value === 'oauth2')) {
$('.at-oauth').show();
}
Meteor.call('isPasswordLoginEnabled', (_, result) => {
if (result) {
$('.at-pwd-form').show();
}
if (result && this.authenticationMethods.get().length > 1) {
$('.at-sep').show();
}
});
});
});