Moodle
  1. Moodle
  2. MDL-30706

MyMobile theme bug with external authentication

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.2.1
    • Component/s: Themes
    • Labels:
    • Environment:
      N/A
    • Database:
      Any
    • Testing Instructions:
      Hide

      [To test this properly you need an external SSO system like CAS. However I have had our testers do this at LUNS, so it can be tested without this by]

      1/ Switching site to the MyMobile theme (especially on Mobile device but not necessary)
      2/ Ensuring that you can login and logout through the various login links round the page (top right hand corner, bottom of page etC)

      Show
      [To test this properly you need an external SSO system like CAS. However I have had our testers do this at LUNS, so it can be tested without this by] 1/ Switching site to the MyMobile theme (especially on Mobile device but not necessary) 2/ Ensuring that you can login and logout through the various login links round the page (top right hand corner, bottom of page etC)
    • Workaround:
      Hide

      I found out that if I add the data-ajax="false" attribute to the login link tag it fixes the issue. This can be found in the MyMobile renderers.php file on line 342. I tested this workaround with CAS enabled and disabled. It works both ways so it should be a safe fix.

      After the fix, line 342:

      $loggedinas = '<a data-role="button" data-icon="alert" data-ajax="false" class="ui-btn-right nolog" href="'.$loginurl.'" data-prefetch>'.get_string('login').'</a>';
      
      Show
      I found out that if I add the data-ajax="false" attribute to the login link tag it fixes the issue. This can be found in the MyMobile renderers.php file on line 342. I tested this workaround with CAS enabled and disabled. It works both ways so it should be a safe fix. After the fix, line 342: $loggedinas = '<a data-role= "button" data-icon= "alert" data-ajax= " false " class= "ui-btn-right nolog" href= "'.$loginurl.'" data-prefetch>'.get_string('login').'</a>';
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      33547

      Description

      In Moodle 2.2, the MyMobile theme cannot handle external authentication. This is because it tries to use Ajax when loading the login page. This works great if it uses internal Moodle authencation. However, it doesn't work so great when trying to get external authentication systems such as CAS.

      Replication steps:

      1. Setup and activate CAS authencation.
      2. Navigate to Moodle on mobile device (with MyMobile theme activated).
      3. Tap "Login"
        Receive error message.

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Thanks for reporting this and suggesting a fix.

          Show
          Michael de Raadt added a comment - Thanks for reporting this and suggesting a fix.
          Hide
          Dan Poltawski added a comment - - edited

          We're seeing this too (in fact I commenting about the problem on the original issue).

          I can confirm that the fix suggested does solve the issue for the main login button, but there are other links to login which are not fixed and also need to be told not to loda using ajax.

          Show
          Dan Poltawski added a comment - - edited We're seeing this too (in fact I commenting about the problem on the original issue). I can confirm that the fix suggested does solve the issue for the main login button, but there are other links to login which are not fixed and also need to be told not to loda using ajax.
          Hide
          John Stabinger added a comment -

          I'm guessing that something (some JS?) needs to load on the page for external auth, and this is not happening unless a full page load (not ajax) is done. I'll need to change all references to login to force the full page load instead of ajax. Not a big deal.

          Show
          John Stabinger added a comment - I'm guessing that something (some JS?) needs to load on the page for external auth, and this is not happening unless a full page load (not ajax) is done. I'll need to change all references to login to force the full page load instead of ajax. Not a big deal.
          Hide
          Dan Poltawski added a comment -

          Hi John,

          In our case its that the /login/ gets redirected using an apache module elsewhere to actually do the authentication, when loading through ajax it doesn't allow that redirect to happen.

          I think I have found all places where this is the case, so I am preparing a patch.

          Show
          Dan Poltawski added a comment - Hi John, In our case its that the /login/ gets redirected using an apache module elsewhere to actually do the authentication, when loading through ajax it doesn't allow that redirect to happen. I think I have found all places where this is the case, so I am preparing a patch.
          Hide
          Dan Poltawski added a comment -

          Hi John,

          Could you review my patch?

          Thanks

          Show
          Dan Poltawski added a comment - Hi John, Could you review my patch? Thanks
          Hide
          John Stabinger added a comment -

          Dan,

          I have never reviewed a patch before, but it looks fine to me. However, I would remove the data-prefetch from line 339. The prefetch only works when the page is going to be loaded by ajax. It 'prefetches' it and is no longer necessary to preload a page we will not be using...

          Show
          John Stabinger added a comment - Dan, I have never reviewed a patch before, but it looks fine to me. However, I would remove the data-prefetch from line 339. The prefetch only works when the page is going to be loaded by ajax. It 'prefetches' it and is no longer necessary to preload a page we will not be using...
          Hide
          Dan Poltawski added a comment -

          Thanks, I have updated the patch as suggested.

          Show
          Dan Poltawski added a comment - Thanks, I have updated the patch as suggested.
          Hide
          Dan Poltawski added a comment -

          Submitting for integration, integrators this can be cherrypicked into 22_STABLE

          Show
          Dan Poltawski added a comment - Submitting for integration, integrators this can be cherrypicked into 22_STABLE
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Sam Hemelryk added a comment -

          Thanks Dan, the changes look spot on. This will be integrated during the next integration cycle.

          Cheers
          Sam

          Show
          Sam Hemelryk added a comment - Thanks Dan, the changes look spot on. This will be integrated during the next integration cycle. Cheers Sam
          Hide
          Sam Hemelryk added a comment -

          Thanks Dan, this has been integrated now

          Show
          Sam Hemelryk added a comment - Thanks Dan, this has been integrated now
          Hide
          Aparup Banerjee added a comment -

          this works for me in as far that i can login/logout

          (although i couldn't replicate this - no SSO/CAS)

          thanks Dan!

          Show
          Aparup Banerjee added a comment - this works for me in as far that i can login/logout (although i couldn't replicate this - no SSO/CAS) thanks Dan!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The git and cvs repositories are happy receiving your very first contribution to Moodle for 2012. Happy new year!

          Closing, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The git and cvs repositories are happy receiving your very first contribution to Moodle for 2012. Happy new year! Closing, ciao

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: