Skip to content

Commit 9693cda

Browse files
committed
MOBILE-3389 login: Improve error messages and help in login
1 parent fdb6150 commit 9693cda

File tree

8 files changed

+112
-18
lines changed

8 files changed

+112
-18
lines changed

src/assets/img/login/faq_url.png

18.9 KB
Loading

src/assets/lang/en.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,7 +1707,17 @@
17071707
"core.login.emailnotmatch": "Emails do not match",
17081708
"core.login.erroraccesscontrolalloworigin": "The cross-origin call you're trying to perform has been rejected. Please check https://docs.moodle.org/dev/Moodle_Mobile_development_using_Chrome_or_Chromium",
17091709
"core.login.errordeletesite": "An error occurred while deleting this site. Please try again.",
1710+
"core.login.errorexampleurl": "The URL https://campus.example.edu is only an example URL, it's not a real site. Please use the URL of your school or organization's site.",
17101711
"core.login.errorupdatesite": "An error occurred while updating the site's token.",
1712+
"core.login.faqcannotconnectanswer": "Please, contact your site administrator.",
1713+
"core.login.faqcannotconnectquestion": "I typed my site address correctly but I still can't connect.",
1714+
"core.login.faqsetupsiteanswer": "Visit {{$link}} to check out the different options you have to create your own Moodle site.",
1715+
"core.login.faqsetupsitelinktitle": "Get started.",
1716+
"core.login.faqsetupsitequestion": "I want to set up my own Moodle site.",
1717+
"core.login.faqtestappanswer": "To test the app in a Moodle Demo Site, type \"teacher\" or \"student\" in the \"Your site address\" field and click the \"Connect!\" button.",
1718+
"core.login.faqtestappquestion": "I just want to test the app, what can I do?",
1719+
"core.login.faqwhatisurlanswer": "<p>Every organisation or school has their own custom address for their Moodle site.</p><p>To find the address of the Moodle site you want to connect to, do the following:</p><ol><li>Open a web browser and go to your school's or organisation's Moodle site login page</li><li>At the top of the page, on the address bar, you will see the URL of your Moodle site. E.g. \"campus.example.edu\".{{$image}}</li><li>Copy the address (do not copy the /login and what comes after), paste it into the Moodle App and click \"Connect!\"</li><li>Now you can log into your site, using your username and password</li>",
1720+
"core.login.faqwhatisurlquestion": "What is the URL of my Moodle site? How can I find my school’s site?",
17111721
"core.login.findyoursite": "Find your site",
17121722
"core.login.firsttime": "Is this your first time here?",
17131723
"core.login.forcepasswordchangenotice": "You must change your password to proceed.",
@@ -1736,7 +1746,6 @@
17361746
"core.login.mobileservicesnotenabled": "Mobile access is not enabled on your site. Please contact your site administrator if you think it should be enabled.",
17371747
"core.login.mustconfirm": "You need to confirm your account",
17381748
"core.login.newaccount": "New account",
1739-
"core.login.newsitedescription": "Please enter the URL of your Moodle site. Note that it might not be configured to work with this app.",
17401749
"core.login.notloggedin": "You need to be logged in.",
17411750
"core.login.password": "Password",
17421751
"core.login.passwordforgotten": "Forgotten password",
@@ -1762,7 +1771,7 @@
17621771
"core.login.selectacountry": "Select a country",
17631772
"core.login.selectsite": "Please select your site:",
17641773
"core.login.signupplugindisabled": "{{$a}} is not enabled.",
1765-
"core.login.siteaddress": "Site address",
1774+
"core.login.siteaddress": "Your site address",
17661775
"core.login.sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects, this could be the issue that's preventing the app from connecting to your site.",
17671776
"core.login.siteinmaintenance": "Your site is in maintenance mode",
17681777
"core.login.sitepolicynotagreederror": "Site policy not agreed.",
@@ -1816,6 +1825,7 @@
18161825
"core.more": "more",
18171826
"core.mygroups": "My groups",
18181827
"core.name": "Name",
1828+
"core.needhelp": "Need help?",
18191829
"core.networkerroriframemsg": "This content is not available offline. Please connect to the internet and try again.",
18201830
"core.networkerrormsg": "There was a problem connecting to the site. Please check your connection and try again.",
18211831
"core.never": "Never",
@@ -2090,6 +2100,7 @@
20902100
"core.warningofflinedatadeleted": "Offline data from {{component}} '{{name}}' has been deleted. {{error}}",
20912101
"core.whatisyourage": "What is your age?",
20922102
"core.wheredoyoulive": "In which country do you live?",
2103+
"core.whoissiteadmin": "\"Site Administrators\" are the people who manage the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.",
20932104
"core.whoops": "Oops!",
20942105
"core.whyisthishappening": "Why is this happening?",
20952106
"core.whyisthisrequired": "Why is this required?",

src/core/login/lang/en.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,17 @@
2424
"emailnotmatch": "Emails do not match",
2525
"erroraccesscontrolalloworigin": "The cross-origin call you're trying to perform has been rejected. Please check https://docs.moodle.org/dev/Moodle_Mobile_development_using_Chrome_or_Chromium",
2626
"errordeletesite": "An error occurred while deleting this site. Please try again.",
27+
"errorexampleurl": "The URL https://campus.example.edu is only an example URL, it's not a real site. Please use the URL of your school or organization's site.",
2728
"errorupdatesite": "An error occurred while updating the site's token.",
29+
"faqcannotconnectanswer": "Please, contact your site administrator.",
30+
"faqcannotconnectquestion": "I typed my site address correctly but I still can't connect.",
31+
"faqsetupsiteanswer": "Visit {{$link}} to check out the different options you have to create your own Moodle site.",
32+
"faqsetupsitelinktitle": "Get started.",
33+
"faqsetupsitequestion": "I want to set up my own Moodle site.",
34+
"faqtestappanswer": "To test the app in a Moodle Demo Site, type \"teacher\" or \"student\" in the \"Your site address\" field and click the \"Connect!\" button.",
35+
"faqtestappquestion": "I just want to test the app, what can I do?",
36+
"faqwhatisurlanswer": "<p>Every organisation or school has their own custom address for their Moodle site.</p><p>To find the address of the Moodle site you want to connect to, do the following:</p><ol><li>Open a web browser and go to your school's or organisation's Moodle site login page</li><li>At the top of the page, on the address bar, you will see the URL of your Moodle site. E.g. \"campus.example.edu\".{{$image}}</li><li>Copy the address (do not copy the /login and what comes after), paste it into the Moodle App and click \"Connect!\"</li><li>Now you can log into your site, using your username and password</li>",
37+
"faqwhatisurlquestion": "What is the URL of my Moodle site? How can I find my school’s site?",
2838
"findyoursite": "Find your site",
2939
"firsttime": "Is this your first time here?",
3040
"forcepasswordchangenotice": "You must change your password to proceed.",
@@ -53,7 +63,6 @@
5363
"mobileservicesnotenabled": "Mobile access is not enabled on your site. Please contact your site administrator if you think it should be enabled.",
5464
"mustconfirm": "You need to confirm your account",
5565
"newaccount": "New account",
56-
"newsitedescription": "Please enter the URL of your Moodle site. Note that it might not be configured to work with this app.",
5766
"notloggedin": "You need to be logged in.",
5867
"password": "Password",
5968
"passwordforgotten": "Forgotten password",
@@ -79,7 +88,7 @@
7988
"selectacountry": "Select a country",
8089
"selectsite": "Please select your site:",
8190
"signupplugindisabled": "{{$a}} is not enabled.",
82-
"siteaddress": "Site address",
91+
"siteaddress": "Your site address",
8392
"sitehasredirect": "Your site contains at least one HTTP redirect. The app cannot follow redirects, this could be the issue that's preventing the app from connecting to your site.",
8493
"siteinmaintenance": "Your site is in maintenance mode",
8594
"sitepolicynotagreederror": "Site policy not agreed.",

src/core/login/pages/site-help/site-help.html

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,29 @@
1010
</ion-navbar>
1111
</ion-header>
1212
<ion-content padding>
13-
<core-format-text [text]="'core.login.helpmelogin' | translate" [filter]="false"></core-format-text>
13+
<ion-list>
14+
<ion-item text-wrap>
15+
<h2><b>{{ 'core.login.faqwhatisurlquestion' | translate }}</b></h2>
16+
</ion-item>
17+
<ion-item text-wrap [innerHTML]="'core.login.faqwhatisurlanswer' | translate: {$image: urlImageHtml}">
18+
</ion-item>
19+
<ion-item text-wrap>
20+
<h2><b>{{ 'core.login.faqcannotconnectquestion' | translate }}</b></h2>
21+
</ion-item>
22+
<ion-item text-wrap>
23+
<p>{{ 'core.login.faqcannotconnectanswer' | translate }} {{ 'core.whoissiteadmin' | translate }}</p>
24+
</ion-item>
25+
<ion-item text-wrap>
26+
<h2><b>{{ 'core.login.faqsetupsitequestion' | translate }}</b></h2>
27+
</ion-item>
28+
<ion-item text-wrap>
29+
<p><core-format-text [text]="'core.login.faqsetupsiteanswer' | translate:{$link: setupLinkHtml}" [filter]="false"></core-format-text></p>
30+
</ion-item>
31+
<ion-item text-wrap>
32+
<h2><b>{{ 'core.login.faqtestappquestion' | translate }}</b></h2>
33+
</ion-item>
34+
<ion-item text-wrap>
35+
<p>{{ 'core.login.faqtestappanswer' | translate }}</p>
36+
</ion-item>
37+
</ion-list>
1438
</ion-content>

src/core/login/pages/site-help/site-help.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import { Component } from '@angular/core';
1616
import { IonicPage, ViewController } from 'ionic-angular';
17+
import { TranslateService } from '@ngx-translate/core';
1718

1819
/**
1920
* Component that displays some help regarding the CoreLoginSitePage.
@@ -24,7 +25,17 @@ import { IonicPage, ViewController } from 'ionic-angular';
2425
templateUrl: 'site-help.html',
2526
})
2627
export class CoreLoginSiteHelpPage {
27-
constructor(private viewCtrl: ViewController) { }
28+
29+
urlImageHtml: string;
30+
setupLinkHtml: string;
31+
32+
constructor(protected viewCtrl: ViewController,
33+
protected translate: TranslateService) {
34+
35+
this.urlImageHtml = '<img src="assets/img/login/faq_url.png" role="presentation">';
36+
this.setupLinkHtml = '<a href="https://moodle.com/getstarted/" title="' +
37+
this.translate.instant('core.login.faqsetupsitelinktitle') + '">https://moodle.com/getstarted/</a>';
38+
}
2839

2940
/**
3041
* Close help modal.

src/core/login/pages/site/site.html

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
<button ion-button icon-only navPush="CoreAppSettingsPage" [attr.aria-label]="'core.settings.appsettings' | translate">
77
<core-icon name="fa-cogs"></core-icon>
88
</button>
9-
<button ion-button icon-only (click)="showHelp()" [attr.aria-label]="'core.help' | translate">
10-
<ion-icon name="help-circle"></ion-icon>
11-
</button>
129
</ion-buttons>
1310
</ion-navbar>
1411
</ion-header>
@@ -20,9 +17,9 @@
2017
<form ion-list [formGroup]="siteForm" (ngSubmit)="connect($event, siteForm.value.siteUrl)" *ngIf="!fixedSites || fixedDisplay == 'select'" #siteFormEl>
2118
<!-- Form to input the site URL if there are no fixed sites. -->
2219
<ng-container *ngIf="!fixedSites">
23-
<p padding>{{ 'core.login.newsitedescription' | translate }}</p>
2420
<ion-item>
25-
<ion-input type="url" name="url" placeholder="{{ 'core.login.siteaddress' | translate }}" formControlName="siteUrl" [core-auto-focus]="showKeyboard"></ion-input>
21+
<ion-label stacked><h2>{{ 'core.login.siteaddress' | translate }}</h2></ion-label>
22+
<ion-input type="url" name="url" placeholder="https://campus.example.edu" formControlName="siteUrl" [core-auto-focus]="showKeyboard"></ion-input>
2623
</ion-item>
2724
</ng-container>
2825

@@ -50,5 +47,29 @@ <h2>{{site.name}}</h2>
5047
<p class="padding no-padding-bottom">{{ 'core.login.selectsite' | translate }}</p>
5148
<a *ngFor="let site of fixedSites" ion-button block (click)="connect($event, site.url)" [title]="site.name" margin-bottom>{{site.name}}</a>
5249
</div>
50+
51+
<!-- Error. -->
52+
<ion-card padding *ngIf="errorMessage">
53+
<ion-item>
54+
<h3>{{ 'core.whoops' | translate }}</h3>
55+
<button ion-button icon-only item-end (click)="hideLoginIssue()" [attr.aria-label]="'core.hide' | translate">
56+
<ion-icon name="close"></ion-icon>
57+
</button>
58+
</ion-item>
59+
<p><core-format-text [text]="errorMessage" [filter]="false"></core-format-text></p>
60+
<p>{{ 'core.login.problemconnectingerror' | translate }}</p>
61+
<p padding>{{ errorUrl }}</p>
62+
<p>{{ 'core.login.problemconnectingerrorcontinue' | translate }}</p>
63+
<h3>{{ 'core.login.stillcantconnect' | translate }}</h3>
64+
<p>{{ 'core.login.contactyouradministrator' | translate }}</p>
65+
<p>{{ 'core.whoissiteadmin' | translate }}</p>
66+
</ion-card>
67+
68+
<!-- Help. -->
69+
<ion-list>
70+
<a ion-item text-center (click)="showHelp()">
71+
{{ 'core.needhelp' | translate }}
72+
</a>
73+
</ion-list>
5374
</div>
5475
</ion-content>

src/core/login/pages/site/site.ts

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { CoreConfigConstants } from '../../../../configconstants';
2222
import { CoreLoginHelperProvider } from '../../providers/helper';
2323
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
2424
import { CoreUrl } from '@classes/utils/url';
25+
import { TranslateService } from '@ngx-translate/core';
2526

2627
/**
2728
* Page to enter or select the site URL to connect to.
@@ -41,6 +42,8 @@ export class CoreLoginSitePage {
4142
fixedDisplay = 'buttons';
4243
showKeyboard = false;
4344
filter = '';
45+
errorUrl: string;
46+
errorMessage: string;
4447

4548
constructor(navParams: NavParams,
4649
protected navCtrl: NavController,
@@ -50,7 +53,8 @@ export class CoreLoginSitePage {
5053
protected loginHelper: CoreLoginHelperProvider,
5154
protected modalCtrl: ModalController,
5255
protected domUtils: CoreDomUtilsProvider,
53-
protected eventsProvider: CoreEventsProvider) {
56+
protected eventsProvider: CoreEventsProvider,
57+
protected translate: TranslateService) {
5458

5559
this.showKeyboard = !!navParams.get('showKeyboard');
5660

@@ -99,6 +103,14 @@ export class CoreLoginSitePage {
99103

100104
url = url.trim();
101105

106+
if (url.match(/^(https?:\/\/)?campus\.example\.edu/)) {
107+
this.showLoginIssue(url, this.translate.instant('core.login.errorexampleurl'));
108+
109+
return;
110+
}
111+
112+
this.hideLoginIssue();
113+
102114
const modal = this.domUtils.showModalLoading(),
103115
siteData = this.sitesProvider.getDemoSiteData(url);
104116

@@ -164,19 +176,23 @@ export class CoreLoginSitePage {
164176
modal.present();
165177
}
166178

179+
/**
180+
* Hide the login error.
181+
*/
182+
hideLoginIssue(): void {
183+
this.errorUrl = null;
184+
this.errorMessage = null;
185+
}
186+
167187
/**
168188
* Show an error that aims people to solve the issue.
169189
*
170190
* @param url The URL the user was trying to connect to.
171191
* @param error Error to display.
172192
*/
173193
protected showLoginIssue(url: string, error: any): void {
174-
const modal = this.modalCtrl.create('CoreLoginSiteErrorPage', {
175-
siteUrl: url,
176-
issue: this.domUtils.getErrorMessage(error)
177-
});
178-
179-
modal.present();
194+
this.errorUrl = url;
195+
this.errorMessage = this.domUtils.getErrorMessage(error);
180196
}
181197

182198
/**

src/lang/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167
"more": "more",
168168
"mygroups": "My groups",
169169
"name": "Name",
170+
"needhelp": "Need help?",
170171
"networkerroriframemsg": "This content is not available offline. Please connect to the internet and try again.",
171172
"networkerrormsg": "There was a problem connecting to the site. Please check your connection and try again.",
172173
"never": "Never",
@@ -293,6 +294,7 @@
293294
"warningofflinedatadeleted": "Offline data from {{component}} '{{name}}' has been deleted. {{error}}",
294295
"whatisyourage": "What is your age?",
295296
"wheredoyoulive": "In which country do you live?",
297+
"whoissiteadmin": "\"Site Administrators\" are the people who manage the Moodle at your school/university/company or learning organisation. If you don't know how to contact them, please contact your teachers/trainers.",
296298
"whoops": "Oops!",
297299
"whyisthishappening": "Why is this happening?",
298300
"whyisthisrequired": "Why is this required?",

0 commit comments

Comments
 (0)