Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-56739

New account confirmation e-mail should launch and log-in the user in the app automatically

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Install the Moodle Mobile app in your mobile device
      2. Important, the Moodle site must be accessible from your mobile device
      3. In the Moodle site, enable authentication via e-mail (aka enable users to create their own accounts in the site)
      4. Ensure that advanced options like re-captcha are disabled
      5. Now, execute the following curl command to create a new user account in the site simulating to be the Mobile app (important, use a real user email account that you can open in your mobile device):

        curl 'http://192.168.1.103/m/stable_master/lib/ajax/service.php' --data-binary '[{"index":0,"methodname":"auth_email_signup_user","args":{"username": "u2", "password": "moodle", "email": "myrealemail@gmail.com", "firstname": "asb", "lastname": "asdfasdf", "city": "Barcelona", "country": "ES", "redirect": "http://192.168.1.103/m/stable_master/admin/tool/mobile/launch.php?service=moodle_mobile_app&passport=xyz&confirmed=1"}}]' | python -m "json.tool"

      6. If the user is correctly created, you will see a "success": true (among other data)
      7. You should receive then an e-mail with the account confirmation link, open the email in your mobile device and click the link
      8. The Mobile app will be launched (please, note that you will see an error or you won't be automatically logged in the site because the functionality is not yet implemented in the app)
      9. Go to the Moodle site, and confirm that the user account is confirmed
      10. Repeat the process (deleting the previous user) and now open the e-mail in your computer, you should see the standard Confirmation screen with a link to "Courses" (at the bottom you will see also a link to try to launch the app that won't work in desktop)
      11. Finally, create a new Moodle user account using the Moodle Web interface to ensure that no regressions were introduced with the changes
      Show
      Install the Moodle Mobile app in your mobile device Important, the Moodle site must be accessible from your mobile device In the Moodle site, enable authentication via e-mail (aka enable users to create their own accounts in the site) Ensure that advanced options like re-captcha are disabled Now, execute the following curl command to create a new user account in the site simulating to be the Mobile app (important, use a real user email account that you can open in your mobile device): curl 'http://192.168.1.103/m/stable_master/lib/ajax/service.php' --data-binary ' [{"index":0,"methodname":"auth_email_signup_user","args":{"username": "u2", "password": "moodle", "email": "myrealemail@gmail.com", "firstname": "asb", "lastname": "asdfasdf", "city": "Barcelona", "country": "ES", "redirect": "http://192.168.1.103/m/stable_master/admin/tool/mobile/launch.php?service=moodle_mobile_app&passport=xyz&confirmed=1"}}] ' | python -m "json.tool" If the user is correctly created, you will see a "success": true (among other data) You should receive then an e-mail with the account confirmation link, open the email in your mobile device and click the link The Mobile app will be launched (please, note that you will see an error or you won't be automatically logged in the site because the functionality is not yet implemented in the app) Go to the Moodle site, and confirm that the user account is confirmed Repeat the process (deleting the previous user) and now open the e-mail in your computer, you should see the standard Confirmation screen with a link to "Courses" (at the bottom you will see also a link to try to launch the app that won't work in desktop) Finally, create a new Moodle user account using the Moodle Web interface to ensure that no regressions were introduced with the changes
    • Affected Branches:
      MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-56739-master

      Description

      If a new user account is created using the Mobile app, the confirmation e-mail should launch the app (and log-in the user) after the confirmation process is finished.

      This will require the following changes:

      • Pass two new parameters to auth_email_signup_user: (appservice, appurlscheme)
      • Modify the auth_plugin_base->user_signup function to allow a new parameter: $confirmationurl (so we can indicate what URL to use when confirming a user)
      • Modify the login/confirm.php to support a new parameter $urltogo . To redirect the user to tool/mobile/launch.php after is confirmed

      The process is:

      • When a user is created via the mobile app, we'll pass two additional parameters: appservice, appurlscheme
      • The WS auth_email_signup_user will check if they are not empty, in that case when doing the $authplugin->user_signup($user, false); a new parameter $confirmationurl will be passed, it will point to the current confirmation URL but passing an additional parameter $urltogo that will redirect to tool/mobile/launch.php passing appservice, appurlscheme as parameters
      • login/confirm.php will check if an $urltogo is set and we redirect the browser to it after the user is confirmed. In that way, the app will be launched via the standard tool/mobile/launch.php

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  5/Dec/16