MOBILE-4680 login: Fix demo site qr scan hiding

main
Pau Ferrer Ocaña 2025-01-13 16:01:56 +01:00
parent 47c82009a2
commit 6d0dcf2d1c
4 changed files with 26 additions and 15 deletions

View File

@ -67,8 +67,6 @@ export class CoreLoginMethodsComponent implements OnInit {
}
if (this.site) {
this.showScanQR = CoreLoginHelper.displayQRInSiteScreen();
// The identity provider set in the site will be shown at the top.
const oAuthId = this.site.getOAuthId();
this.currentLoginProvider = CoreLoginHelper.findIdentityProvider(this.identityProviders, oAuthId);
@ -78,15 +76,36 @@ export class CoreLoginMethodsComponent implements OnInit {
provider.url !== this.currentLoginProvider?.url);
}
// If still false or credentials screen.
if (!this.site || !this.showScanQR) {
this.showScanQR = await CoreLoginHelper.displayQRInCredentialsScreen(this.siteConfig.tool_mobile_qrcodetype);
}
await this.setShowScanQR();
}
this.isReady.resolve();
}
/**
* Set if should show the scan QR code button.
*/
async setShowScanQR(): Promise<void> {
if (this.site) {
if (this.site.isDemoModeSite()) {
this.showScanQR = false;
return;
}
this.showScanQR = CoreLoginHelper.displayQRInSiteScreen();
if (this.showScanQR) {
return;
}
}
// If still false or credentials screen.
if (this.siteConfig) {
this.showScanQR = await CoreLoginHelper.displayQRInCredentialsScreen(this.siteConfig.tool_mobile_qrcodetype);
}
}
/**
* Show instructions and scan QR code.
*/

View File

@ -62,7 +62,6 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
pageLoaded = false;
isBrowserSSO = false;
showForgottenPassword = true;
showScanQR = false;
loginAttempts = 0;
supportConfig?: CoreUserSupportConfig;
exceededAttemptsHTML?: SafeHtml | string | null;
@ -213,12 +212,6 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
return;
}
if (this.site.isDemoModeSite()) {
this.showScanQR = false;
} else {
this.showScanQR = await CoreLoginHelper.displayQRInCredentialsScreen(this.siteConfig.tool_mobile_qrcodetype);
}
this.canSignup = this.siteConfig.registerauth == 'email' && !this.site.isFeatureDisabled(EMAIL_SIGNUP_FEATURE_NAME);
this.showForgottenPassword = !this.site.isFeatureDisabled(FORGOTTEN_PASSWORD_FEATURE_NAME);
this.exceededAttemptsHTML = CoreLoginHelper.buildExceededAttemptsHTML(

View File

@ -69,7 +69,6 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
isLoggedOut: boolean;
siteId!: string;
siteInfo?: CoreSiteBasicInfo;
showScanQR = false;
showLoading = true;
reconnectAttempts = 0;
supportConfig?: CoreUserSupportConfig;

View File

@ -1269,7 +1269,7 @@ export class CoreLoginHelperProvider {
(CoreConstants.CONFIG.displayqroncredentialscreen !== undefined &&
!!CoreConstants.CONFIG.displayqroncredentialscreen)) {
return qrCodeType == CoreSiteQRCodeType.QR_CODE_LOGIN;
return qrCodeType === CoreSiteQRCodeType.QR_CODE_LOGIN;
}
return false;