MOBILE-4059 login: Show help without support link

main
Noel De Martin 2022-11-07 13:01:59 +01:00
parent 9b0200c3bf
commit fc55a31872
9 changed files with 24 additions and 6 deletions

View File

@ -1932,6 +1932,7 @@
"core.login.errorqrnoscheme": "local_moodlemobileapp",
"core.login.errorupdatesite": "local_moodlemobileapp",
"core.login.exceededloginattempts": "local_moodlemobileapp",
"core.login.exceededloginattemptsfallback": "local_moodlemobileapp",
"core.login.exceededloginattemptssupportsubject": "local_moodlemobileapp",
"core.login.exceededpasswordresetattempts": "local_moodlemobileapp",
"core.login.exceededpasswordresetattemptssupportsubject": "local_moodlemobileapp",

View File

@ -1,11 +1,11 @@
<ion-card *ngIf="canContactSupport" class="core-danger-card">
<ion-card class="core-danger-card">
<ion-item>
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
<ion-label>
<p>
<ng-content></ng-content>
</p>
<ion-button fill="outline" color="medium" (click)="contactSupport()">
<ion-button *ngIf="canContactSupport" fill="outline" color="medium" (click)="contactSupport()">
{{ 'core.contactsupport' | translate }}
</ion-button>
</ion-label>

View File

@ -28,7 +28,8 @@
"errorexampleurl": "The URL https://campus.example.edu is only an example URL, it's not a real site. <strong>Please use the URL of your school or organization's site.</strong>",
"errorqrnoscheme": "This URL isn't a valid login URL.",
"errorupdatesite": "An error occurred while updating the site's token.",
"exceededloginattempts": "Need help logging in? Try recovering your password or contact your site support",
"exceededloginattempts": "Need help logging in? Try recovering your password or contact your site support.",
"exceededloginattemptsfallback": "Need help logging in? Try recovering your password.",
"exceededloginattemptssupportsubject": "I can't log in",
"exceededpasswordresetattempts": "It seems you are having trouble accessing your account. You can contact your school or learning provider or try again later.",
"exceededpasswordresetattemptssupportsubject": "I can't reset my password",

View File

@ -35,7 +35,12 @@
<core-login-exceeded-attempts *ngIf="supportConfig && loginAttempts >= 3" [supportConfig]="supportConfig"
[supportSubject]="'core.login.exceededloginattemptssupportsubject' | translate">
{{ 'core.login.exceededloginattempts' | translate }}
<span *ngIf="canContactSupport">
{{ 'core.login.exceededloginattempts' | translate }}
</span>
<span *ngIf="!canContactSupport">
{{ 'core.login.exceededloginattemptsfallback' | translate }}
</span>
</core-login-exceeded-attempts>
<form [formGroup]="credForm" (ngSubmit)="login($event)" class="core-login-form" #credentialsForm>

View File

@ -59,6 +59,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
showScanQR = false;
loginAttempts = 0;
supportConfig?: CoreUserSupportConfig;
canContactSupport?: boolean;
protected siteConfig?: CoreSitePublicConfigResponse;
protected eventThrown = false;
@ -82,6 +83,7 @@ export class CoreLoginCredentialsPage implements OnInit, OnDestroy {
this.siteConfig = CoreNavigator.getRouteParam<CoreSitePublicConfigResponse>('siteConfig');
this.urlToOpen = CoreNavigator.getRouteParam('urlToOpen');
this.supportConfig = this.siteConfig && new CoreUserGuestSupportConfig(this.siteConfig);
this.canContactSupport = this.supportConfig?.canContactSupport();
} catch (error) {
CoreDomUtils.showErrorModal(error);

View File

@ -11,7 +11,7 @@
</ion-header>
<ion-content>
<div class="list-item-limited-width">
<core-login-exceeded-attempts *ngIf="supportConfig && wasPasswordResetRequestedRecently" [supportConfig]="supportConfig"
<core-login-exceeded-attempts *ngIf="canContactSupport && wasPasswordResetRequestedRecently" [supportConfig]="supportConfig"
[supportSubject]="'core.login.exceededpasswordresetattemptssupportsubject' | translate">
{{ 'core.login.exceededpasswordresetattempts' | translate }}
</core-login-exceeded-attempts>

View File

@ -41,6 +41,7 @@ export class CoreLoginForgottenPasswordPage implements OnInit {
siteUrl!: string;
autoFocus!: boolean;
supportConfig?: CoreUserSupportConfig;
canContactSupport?: boolean;
wasPasswordResetRequestedRecently = false;
constructor(protected formBuilder: FormBuilder) {}
@ -67,6 +68,7 @@ export class CoreLoginForgottenPasswordPage implements OnInit {
});
this.supportConfig = siteConfig && new CoreUserGuestSupportConfig(siteConfig);
this.canContactSupport = this.supportConfig?.canContactSupport();
this.wasPasswordResetRequestedRecently = await CoreLoginHelper.wasPasswordResetRequestedRecently(siteUrl);
}

View File

@ -45,7 +45,12 @@
<core-login-exceeded-attempts *ngIf="supportConfig && reconnectAttempts >= 3" [supportConfig]="supportConfig"
[supportSubject]="'core.login.exceededloginattemptssupportsubject' | translate">
{{ 'core.login.exceededloginattempts' | translate }}
<span *ngIf="canContactSupport">
{{ 'core.login.exceededloginattempts' | translate }}
</span>
<span *ngIf="!canContactSupport">
{{ 'core.login.exceededloginattemptsfallback' | translate }}
</span>
</core-login-exceeded-attempts>
</div>
<form *ngIf="!isOAuth" [formGroup]="credForm" (ngSubmit)="login($event)" class="core-login-form" #reconnectForm>

View File

@ -61,6 +61,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
showLoading = true;
reconnectAttempts = 0;
supportConfig?: CoreUserSupportConfig;
canContactSupport?: boolean;
protected siteConfig?: CoreSitePublicConfigResponse;
protected viewLeft = false;
@ -108,6 +109,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
this.siteUrl = site.infos.siteurl;
this.siteName = site.getSiteName();
this.supportConfig = new CoreUserAuthenticatedSupportConfig(site);
this.canContactSupport = this.supportConfig.canContactSupport();
// If login was OAuth we should only reach this page if the OAuth method ID has changed.
this.isOAuth = site.isOAuth();