diff --git a/src/assets/img/login/faq_url.png b/src/assets/img/login/faq_url.png new file mode 100644 index 000000000..13d92cd50 Binary files /dev/null and b/src/assets/img/login/faq_url.png differ diff --git a/src/assets/lang/en.json b/src/assets/lang/en.json index 51b1c753d..dc5a9f227 100644 --- a/src/assets/lang/en.json +++ b/src/assets/lang/en.json @@ -1707,7 +1707,17 @@ "core.login.emailnotmatch": "Emails do not match", "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", "core.login.errordeletesite": "An error occurred while deleting this site. Please try again.", + "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.", "core.login.errorupdatesite": "An error occurred while updating the site's token.", + "core.login.faqcannotconnectanswer": "Please, contact your site administrator.", + "core.login.faqcannotconnectquestion": "I typed my site address correctly but I still can't connect.", + "core.login.faqsetupsiteanswer": "Visit {{$link}} to check out the different options you have to create your own Moodle site.", + "core.login.faqsetupsitelinktitle": "Get started.", + "core.login.faqsetupsitequestion": "I want to set up my own Moodle site.", + "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.", + "core.login.faqtestappquestion": "I just want to test the app, what can I do?", + "core.login.faqwhatisurlanswer": "

Every organisation or school has their own custom address for their Moodle site.

To find the address of the Moodle site you want to connect to, do the following:

  1. Open a web browser and go to your school's or organisation's Moodle site login page
  2. 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}}
  3. Copy the address (do not copy the /login and what comes after), paste it into the Moodle App and click \"Connect!\"
  4. Now you can log into your site, using your username and password
  5. ", + "core.login.faqwhatisurlquestion": "What is the URL of my Moodle site? How can I find my school’s site?", "core.login.findyoursite": "Find your site", "core.login.firsttime": "Is this your first time here?", "core.login.forcepasswordchangenotice": "You must change your password to proceed.", @@ -1736,7 +1746,6 @@ "core.login.mobileservicesnotenabled": "Mobile access is not enabled on your site. Please contact your site administrator if you think it should be enabled.", "core.login.mustconfirm": "You need to confirm your account", "core.login.newaccount": "New account", - "core.login.newsitedescription": "Please enter the URL of your Moodle site. Note that it might not be configured to work with this app.", "core.login.notloggedin": "You need to be logged in.", "core.login.password": "Password", "core.login.passwordforgotten": "Forgotten password", @@ -1762,7 +1771,7 @@ "core.login.selectacountry": "Select a country", "core.login.selectsite": "Please select your site:", "core.login.signupplugindisabled": "{{$a}} is not enabled.", - "core.login.siteaddress": "Site address", + "core.login.siteaddress": "Your site address", "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.", "core.login.siteinmaintenance": "Your site is in maintenance mode", "core.login.sitepolicynotagreederror": "Site policy not agreed.", @@ -1816,6 +1825,7 @@ "core.more": "more", "core.mygroups": "My groups", "core.name": "Name", + "core.needhelp": "Need help?", "core.networkerroriframemsg": "This content is not available offline. Please connect to the internet and try again.", "core.networkerrormsg": "There was a problem connecting to the site. Please check your connection and try again.", "core.never": "Never", @@ -2090,6 +2100,7 @@ "core.warningofflinedatadeleted": "Offline data from {{component}} '{{name}}' has been deleted. {{error}}", "core.whatisyourage": "What is your age?", "core.wheredoyoulive": "In which country do you live?", + "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.", "core.whoops": "Oops!", "core.whyisthishappening": "Why is this happening?", "core.whyisthisrequired": "Why is this required?", diff --git a/src/core/login/lang/en.json b/src/core/login/lang/en.json index 054a51168..e6a0d6e2f 100644 --- a/src/core/login/lang/en.json +++ b/src/core/login/lang/en.json @@ -24,7 +24,17 @@ "emailnotmatch": "Emails do not match", "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", "errordeletesite": "An error occurred while deleting this site. Please try again.", + "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.", "errorupdatesite": "An error occurred while updating the site's token.", + "faqcannotconnectanswer": "Please, contact your site administrator.", + "faqcannotconnectquestion": "I typed my site address correctly but I still can't connect.", + "faqsetupsiteanswer": "Visit {{$link}} to check out the different options you have to create your own Moodle site.", + "faqsetupsitelinktitle": "Get started.", + "faqsetupsitequestion": "I want to set up my own Moodle site.", + "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.", + "faqtestappquestion": "I just want to test the app, what can I do?", + "faqwhatisurlanswer": "

    Every organisation or school has their own custom address for their Moodle site.

    To find the address of the Moodle site you want to connect to, do the following:

    1. Open a web browser and go to your school's or organisation's Moodle site login page
    2. 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}}
    3. Copy the address (do not copy the /login and what comes after), paste it into the Moodle App and click \"Connect!\"
    4. Now you can log into your site, using your username and password
    5. ", + "faqwhatisurlquestion": "What is the URL of my Moodle site? How can I find my school’s site?", "findyoursite": "Find your site", "firsttime": "Is this your first time here?", "forcepasswordchangenotice": "You must change your password to proceed.", @@ -53,7 +63,6 @@ "mobileservicesnotenabled": "Mobile access is not enabled on your site. Please contact your site administrator if you think it should be enabled.", "mustconfirm": "You need to confirm your account", "newaccount": "New account", - "newsitedescription": "Please enter the URL of your Moodle site. Note that it might not be configured to work with this app.", "notloggedin": "You need to be logged in.", "password": "Password", "passwordforgotten": "Forgotten password", @@ -79,7 +88,7 @@ "selectacountry": "Select a country", "selectsite": "Please select your site:", "signupplugindisabled": "{{$a}} is not enabled.", - "siteaddress": "Site address", + "siteaddress": "Your site address", "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.", "siteinmaintenance": "Your site is in maintenance mode", "sitepolicynotagreederror": "Site policy not agreed.", diff --git a/src/core/login/pages/site-help/site-help.html b/src/core/login/pages/site-help/site-help.html index ae21bace1..48dcf8eb7 100644 --- a/src/core/login/pages/site-help/site-help.html +++ b/src/core/login/pages/site-help/site-help.html @@ -10,5 +10,29 @@ - + + +

      {{ 'core.login.faqwhatisurlquestion' | translate }}

      +
      + + + +

      {{ 'core.login.faqcannotconnectquestion' | translate }}

      +
      + +

      {{ 'core.login.faqcannotconnectanswer' | translate }} {{ 'core.whoissiteadmin' | translate }}

      +
      + +

      {{ 'core.login.faqsetupsitequestion' | translate }}

      +
      + +

      +
      + +

      {{ 'core.login.faqtestappquestion' | translate }}

      +
      + +

      {{ 'core.login.faqtestappanswer' | translate }}

      +
      +
      diff --git a/src/core/login/pages/site-help/site-help.ts b/src/core/login/pages/site-help/site-help.ts index 90d948b75..eb489e3c2 100644 --- a/src/core/login/pages/site-help/site-help.ts +++ b/src/core/login/pages/site-help/site-help.ts @@ -14,6 +14,7 @@ import { Component } from '@angular/core'; import { IonicPage, ViewController } from 'ionic-angular'; +import { TranslateService } from '@ngx-translate/core'; /** * Component that displays some help regarding the CoreLoginSitePage. @@ -24,7 +25,17 @@ import { IonicPage, ViewController } from 'ionic-angular'; templateUrl: 'site-help.html', }) export class CoreLoginSiteHelpPage { - constructor(private viewCtrl: ViewController) { } + + urlImageHtml: string; + setupLinkHtml: string; + + constructor(protected viewCtrl: ViewController, + protected translate: TranslateService) { + + this.urlImageHtml = ''; + this.setupLinkHtml = 'https://moodle.com/getstarted/'; + } /** * Close help modal. diff --git a/src/core/login/pages/site/site.html b/src/core/login/pages/site/site.html index 8da75c237..8660611f8 100644 --- a/src/core/login/pages/site/site.html +++ b/src/core/login/pages/site/site.html @@ -6,9 +6,6 @@ - @@ -20,9 +17,9 @@
      -

      {{ 'core.login.newsitedescription' | translate }}

      - +

      {{ 'core.login.siteaddress' | translate }}

      +
      @@ -50,5 +47,29 @@

      {{ 'core.login.selectsite' | translate }}

      {{site.name}} + + + + +

      {{ 'core.whoops' | translate }}

      + +
      +

      +

      {{ 'core.login.problemconnectingerror' | translate }}

      +

      {{ errorUrl }}

      +

      {{ 'core.login.problemconnectingerrorcontinue' | translate }}

      +

      {{ 'core.login.stillcantconnect' | translate }}

      +

      {{ 'core.login.contactyouradministrator' | translate }}

      +

      {{ 'core.whoissiteadmin' | translate }}

      +
      + + + + + {{ 'core.needhelp' | translate }} + + diff --git a/src/core/login/pages/site/site.ts b/src/core/login/pages/site/site.ts index 9e44cbd4f..d88fc5bf9 100644 --- a/src/core/login/pages/site/site.ts +++ b/src/core/login/pages/site/site.ts @@ -22,6 +22,7 @@ import { CoreConfigConstants } from '../../../../configconstants'; import { CoreLoginHelperProvider } from '../../providers/helper'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { CoreUrl } from '@classes/utils/url'; +import { TranslateService } from '@ngx-translate/core'; /** * Page to enter or select the site URL to connect to. @@ -41,6 +42,8 @@ export class CoreLoginSitePage { fixedDisplay = 'buttons'; showKeyboard = false; filter = ''; + errorUrl: string; + errorMessage: string; constructor(navParams: NavParams, protected navCtrl: NavController, @@ -50,7 +53,8 @@ export class CoreLoginSitePage { protected loginHelper: CoreLoginHelperProvider, protected modalCtrl: ModalController, protected domUtils: CoreDomUtilsProvider, - protected eventsProvider: CoreEventsProvider) { + protected eventsProvider: CoreEventsProvider, + protected translate: TranslateService) { this.showKeyboard = !!navParams.get('showKeyboard'); @@ -99,6 +103,14 @@ export class CoreLoginSitePage { url = url.trim(); + if (url.match(/^(https?:\/\/)?campus\.example\.edu/)) { + this.showLoginIssue(url, this.translate.instant('core.login.errorexampleurl')); + + return; + } + + this.hideLoginIssue(); + const modal = this.domUtils.showModalLoading(), siteData = this.sitesProvider.getDemoSiteData(url); @@ -164,6 +176,14 @@ export class CoreLoginSitePage { modal.present(); } + /** + * Hide the login error. + */ + hideLoginIssue(): void { + this.errorUrl = null; + this.errorMessage = null; + } + /** * Show an error that aims people to solve the issue. * @@ -171,12 +191,8 @@ export class CoreLoginSitePage { * @param error Error to display. */ protected showLoginIssue(url: string, error: any): void { - const modal = this.modalCtrl.create('CoreLoginSiteErrorPage', { - siteUrl: url, - issue: this.domUtils.getErrorMessage(error) - }); - - modal.present(); + this.errorUrl = url; + this.errorMessage = this.domUtils.getErrorMessage(error); } /** diff --git a/src/lang/en.json b/src/lang/en.json index 876b80259..2e932a7f8 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -167,6 +167,7 @@ "more": "more", "mygroups": "My groups", "name": "Name", + "needhelp": "Need help?", "networkerroriframemsg": "This content is not available offline. Please connect to the internet and try again.", "networkerrormsg": "There was a problem connecting to the site. Please check your connection and try again.", "never": "Never", @@ -293,6 +294,7 @@ "warningofflinedatadeleted": "Offline data from {{component}} '{{name}}' has been deleted. {{error}}", "whatisyourage": "What is your age?", "wheredoyoulive": "In which country do you live?", + "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.", "whoops": "Oops!", "whyisthishappening": "Why is this happening?", "whyisthisrequired": "Why is this required?",