From a5f918c670158fd82f5cd89cca000cfa0dbf2ae1 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Mon, 31 Jul 2023 18:06:00 +0200 Subject: [PATCH 1/3] Remove unneccary and dead code to handle case where custom logo is not set --- client/components/main/layouts.css | 3 --- client/components/main/layouts.jade | 7 +++---- client/components/main/layouts.js | 11 ----------- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/client/components/main/layouts.css b/client/components/main/layouts.css index 29e9e5bc2..044c493d9 100644 --- a/client/components/main/layouts.css +++ b/client/components/main/layouts.css @@ -559,9 +559,6 @@ a:not(.disabled).is-active i.fa { top: 45px; left: 10px; } -#isSettingDatabaseCallDone { - display: none; -} .at-link { color: #17683a; text-decoration: underline; 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..1c2f66554 100644 --- a/client/components/main/layouts.js +++ b/client/components/main/layouts.js @@ -20,8 +20,6 @@ const validator = { }, }; -// let isSettingDatabaseFctCallDone = false; - Template.userFormsLayout.onCreated(function () { const templateInstance = this; templateInstance.currentSetting = new ReactiveVar(); @@ -37,11 +35,6 @@ Template.userFormsLayout.onCreated(function () { 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(); }, }); @@ -86,10 +79,6 @@ Template.userFormsLayout.onRendered(() => { }); Template.userFormsLayout.helpers({ - // isSettingDatabaseCallDone(){ - // return isSettingDatabaseFctCallDone; - // }, - isLegalNoticeLinkExist() { const currSet = Template.instance().currentSetting.get(); if (currSet && currSet !== undefined && currSet != null) { From d17d12e719f488d4ce8d994c507315dc397e3c68 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Tue, 1 Aug 2023 11:55:04 +0200 Subject: [PATCH 2/3] The oidc button text is actually set in the DOM tree change later in the file --- client/components/main/layouts.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/client/components/main/layouts.js b/client/components/main/layouts.js index 1c2f66554..93991dbc8 100644 --- a/client/components/main/layouts.js +++ b/client/components/main/layouts.js @@ -25,19 +25,6 @@ Template.userFormsLayout.onCreated(function () { 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); - } - - return this.stop(); - }, - }); Meteor.call('isPasswordLoginEnabled', (_, result) => { if (result) { $('.at-pwd-form').show(); @@ -53,7 +40,6 @@ Template.userFormsLayout.onCreated(function () { }; Meteor.loginWithOidc(options); } - //else console.log("oidc redirect not set"); }); } Meteor.call('isDisableRegistration', (_, result) => { From 127140998980d323c4190551cf1d3de2bc7ea964 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Tue, 1 Aug 2023 12:57:25 +0200 Subject: [PATCH 3/3] Avoid further UI flickering on load and show/hide OR in login screen if more than one is active Fixes #5028 --- client/components/main/layouts.css | 7 +++--- client/components/main/layouts.js | 8 +------ .../components/settings/connectionMethod.js | 22 ++++++++++++++++--- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/client/components/main/layouts.css b/client/components/main/layouts.css index 044c493d9..640d2dae1 100644 --- a/client/components/main/layouts.css +++ b/client/components/main/layouts.css @@ -564,6 +564,9 @@ a:not(.disabled).is-active i.fa { text-decoration: underline; text-decoration-color: #17683a; } +.at-pwd-form, .at-sep, .at-oauth { + display: none; +} @-moz-keyframes fadeIn { from { opacity: 0; @@ -636,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.js b/client/components/main/layouts.js index 93991dbc8..9dc25b06a 100644 --- a/client/components/main/layouts.js +++ b/client/components/main/layouts.js @@ -25,12 +25,6 @@ Template.userFormsLayout.onCreated(function () { templateInstance.currentSetting = new ReactiveVar(); templateInstance.isLoading = new ReactiveVar(false); - Meteor.call('isPasswordLoginEnabled', (_, result) => { - if (result) { - $('.at-pwd-form').show(); - } - }); - if (!ReactiveCache.getCurrentUser()?.profile) { Meteor.call('isOidcRedirectionEnabled', (_, result) => { if (result) { @@ -42,6 +36,7 @@ Template.userFormsLayout.onCreated(function () { } }); } + Meteor.call('isDisableRegistration', (_, result) => { if (result) { $('.at-signup-link').hide(); @@ -53,7 +48,6 @@ Template.userFormsLayout.onCreated(function () { $('.at-pwd-link').hide(); } }); - }); Template.userFormsLayout.onRendered(() => { 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(); + } + }); }); });