diff --git a/client/components/main/layouts.css b/client/components/main/layouts.css index 29e9e5bc2..640d2dae1 100644 --- a/client/components/main/layouts.css +++ b/client/components/main/layouts.css @@ -559,14 +559,14 @@ a:not(.disabled).is-active i.fa { top: 45px; left: 10px; } -#isSettingDatabaseCallDone { - display: none; -} .at-link { color: #17683a; text-decoration: underline; text-decoration-color: #17683a; } +.at-pwd-form, .at-sep, .at-oauth { + display: none; +} @-moz-keyframes fadeIn { from { opacity: 0; @@ -639,7 +639,3 @@ a:not(.disabled).is-active i.fa { transform: rotate(360deg); } } - -.at-pwd-form { - display: none; -} \ No newline at end of file diff --git a/client/components/main/layouts.jade b/client/components/main/layouts.jade index 0390f3789..109ef4507 100644 --- a/client/components/main/layouts.jade +++ b/client/components/main/layouts.jade @@ -34,10 +34,9 @@ template(name="userFormsLayout") unless currentSetting.customLoginLogoLinkUrl img(src="{{currentSetting.customLoginLogoImageUrl}}" width="300" height="auto") br - unless currentSetting.customLoginLogoImageUrl - div#isSettingDatabaseCallDone - img(src="{{pathFor '/wekan-logo.svg'}}" alt="" width="300" height="auto") - br + else + img(src="{{pathFor '/wekan-logo.svg'}}" alt="" width="300" height="auto") + br if currentSetting.textBelowCustomLoginLogo +viewer | {{currentSetting.textBelowCustomLoginLogo}} diff --git a/client/components/main/layouts.js b/client/components/main/layouts.js index 7ab28966b..9dc25b06a 100644 --- a/client/components/main/layouts.js +++ b/client/components/main/layouts.js @@ -20,37 +20,11 @@ const validator = { }, }; -// let isSettingDatabaseFctCallDone = false; - Template.userFormsLayout.onCreated(function () { const templateInstance = this; templateInstance.currentSetting = new ReactiveVar(); templateInstance.isLoading = new ReactiveVar(false); - Meteor.subscribe('setting', { - onReady() { - templateInstance.currentSetting.set(ReactiveCache.getCurrentSetting()); - let currSetting = templateInstance.currentSetting.curValue; - let oidcBtnElt = $("#at-oidc"); - if(currSetting && currSetting !== undefined && currSetting.oidcBtnText !== undefined && oidcBtnElt != null && oidcBtnElt != undefined){ - let htmlvalue = "" + currSetting.oidcBtnText; - oidcBtnElt.html(htmlvalue); - } - - // isSettingDatabaseFctCallDone = true; - if (currSetting && currSetting !== undefined && currSetting.customLoginLogoImageUrl !== undefined) - document.getElementById("isSettingDatabaseCallDone").style.display = 'none'; - else - document.getElementById("isSettingDatabaseCallDone").style.display = 'block'; - return this.stop(); - }, - }); - Meteor.call('isPasswordLoginEnabled', (_, result) => { - if (result) { - $('.at-pwd-form').show(); - } - }); - if (!ReactiveCache.getCurrentUser()?.profile) { Meteor.call('isOidcRedirectionEnabled', (_, result) => { if (result) { @@ -60,9 +34,9 @@ Template.userFormsLayout.onCreated(function () { }; Meteor.loginWithOidc(options); } - //else console.log("oidc redirect not set"); }); } + Meteor.call('isDisableRegistration', (_, result) => { if (result) { $('.at-signup-link').hide(); @@ -74,7 +48,6 @@ Template.userFormsLayout.onCreated(function () { $('.at-pwd-link').hide(); } }); - }); Template.userFormsLayout.onRendered(() => { @@ -86,10 +59,6 @@ Template.userFormsLayout.onRendered(() => { }); Template.userFormsLayout.helpers({ - // isSettingDatabaseCallDone(){ - // return isSettingDatabaseFctCallDone; - // }, - isLegalNoticeLinkExist() { const currSet = Template.instance().currentSetting.get(); if (currSet && currSet !== undefined && currSet != null) { diff --git a/client/components/settings/connectionMethod.js b/client/components/settings/connectionMethod.js index 6abfd743f..a289df579 100644 --- a/client/components/settings/connectionMethod.js +++ b/client/components/settings/connectionMethod.js @@ -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(); + } + }); }); });