Merge pull request #4283 from crazyserver/MOBILE-4680

MOBILE-4680 login: Fix demo site qr scan hiding
main
Dani Palou 2025-01-14 08:01:44 +01:00 committed by GitHub
commit 11753a420f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 26 additions and 15 deletions

View File

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

View File

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

View File

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

View File

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