Moodle
  1. Moodle
  2. MDL-27684

Uninformative error when user session has timed out

    Details

    • Testing Instructions:
      Hide
      1. Enable debugging
      2. Go to your private files
      3. Click "Add"
      4. Open a new browser window to logout your user
      5. Then browse the repository
      6. Make sure you see a proper error saying that the course or activity is not available.
      7. You will also see an alert about not being able to set the user preferences.
      8. Repeat the test with debugging disabled to ensure that the alert() is not displayed.
      Show
      Enable debugging Go to your private files Click "Add" Open a new browser window to logout your user Then browse the repository Make sure you see a proper error saying that the course or activity is not available. You will also see an alert about not being able to set the user preferences. Repeat the test with debugging disabled to ensure that the alert() is not displayed.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_23_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      wip-MDL-27684-master

      Description

      To reproduce:

      1. Open the file picker.
      2. Wait for your session to timeout (Or just logout in another tab)
      3. Click on some action in the file picker, you get an error "Unsupported redirect detected, script execution terminated"
        • If you click to close the error, it just come back up

      Probably need to check if the user is logged in and if not, throw an appropriate error message. I'm not sure how to solve how the message just keeps coming back up - maybe send something back with the error json to refresh the page (which would send the user to login).

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Dan Poltawski added a comment -

            Marina, reassiging this old issue to you. Confirmed it still affects 2.3

            Show
            Dan Poltawski added a comment - Marina, reassiging this old issue to you. Confirmed it still affects 2.3
            Hide
            Marina Glancy added a comment -

            This issue was assigned to me automatically, however I will not be able to work on this issue in the immediate future. In order to create a truer sense of the state of this issue and to allow other developers to have chance to become involved, I am removing myself as the assignee of this issue.

            For more information, see http://docs.moodle.org/dev/Changes_to_issue_assignment

            Show
            Marina Glancy added a comment - This issue was assigned to me automatically, however I will not be able to work on this issue in the immediate future. In order to create a truer sense of the state of this issue and to allow other developers to have chance to become involved, I am removing myself as the assignee of this issue. For more information, see http://docs.moodle.org/dev/Changes_to_issue_assignment
            Show
            Mohamed Alsharaf added a comment - I have a fix for this issue: 2.4 branch Branch: wip- MDL-27684 -MOODLE_24_STABLE Diff Url: https://github.com/satrun77/moodle/compare/moodle:MOODLE_24_STABLE...wip-MDL-27684-MOODLE_24_STABLE 2.5 branch Branch: wip- MDL-27684 -MOODLE_25_STABLE Diff Url: https://github.com/satrun77/moodle/compare/moodle:MOODLE_25_STABLE...wip-MDL-27684-MOODLE_25_STABLE Master branch Branch: wip- MDL-27684 -master Diff Url: https://github.com/satrun77/moodle/compare/moodle:master...wip-MDL-27684-master
            Hide
            Frédéric Massart added a comment -

            Hi Mohamed,

            thanks for providing a patch for this. Before we allow this patch to be submitted for integration, could you please update the code so that the 4th argument $setwantsurltome is set to false. I know the logic in require_login() would set it back to false, but that's probably cleaner to do it properly.

            Many thanks!
            Fred

            Show
            Frédéric Massart added a comment - Hi Mohamed, thanks for providing a patch for this. Before we allow this patch to be submitted for integration, could you please update the code so that the 4th argument $setwantsurltome is set to false. I know the logic in require_login() would set it back to false, but that's probably cleaner to do it properly. Many thanks! Fred
            Hide
            Mohamed Alsharaf added a comment -

            @Frédéric I have updated the patch

            Show
            Mohamed Alsharaf added a comment - @Frédéric I have updated the patch
            Hide
            Frédéric Massart added a comment -

            Thank you, pushing for integration now.

            Show
            Frédéric Massart added a comment - Thank you, pushing for integration now.
            Hide
            Sam Hemelryk added a comment -

            Thanks guys this has been integrated now

            Show
            Sam Hemelryk added a comment - Thanks guys this has been integrated now
            Hide
            David Monllaó added a comment -

            It works as expected.

            After clicking 'Add...' and logging out in the other window, when I click 'Private files' I see the following alert with the attached error in the JS console and attached modal window message.

            Error updating user preference 'filepicker_recentrepository' using ajax. Clicking this link will repeat the Ajax call that failed so you can see the error: 
            

            "NetworkError: 404 Not Found - http://localhost/INTEGRATION/master/lib/ajax/setuserpref.php?sesskey=eKzZFVPuO8&pref=filepicker_recentrepository&value=5"
            

            Course or activity not accessible.
            

            With debugging disabled I don't see the alert and I just see the Course or activity not accessible modal window with the JS console error.

            Show
            David Monllaó added a comment - It works as expected. After clicking 'Add...' and logging out in the other window, when I click 'Private files' I see the following alert with the attached error in the JS console and attached modal window message. Error updating user preference 'filepicker_recentrepository' using ajax. Clicking this link will repeat the Ajax call that failed so you can see the error: "NetworkError: 404 Not Found - http://localhost/INTEGRATION/master/lib/ajax/setuserpref.php?sesskey=eKzZFVPuO8&pref=filepicker_recentrepository&value=5" Course or activity not accessible. With debugging disabled I don't see the alert and I just see the Course or activity not accessible modal window with the JS console error.
            Hide
            Sam Hemelryk added a comment -

            Yarrr me 'arties, good job done. Yer code 'as landed and the weeklies ave been released with your contributions in tow.
            The brethren thank ya for yer 'ard work and if there'd been treasure to ave ya would ave got yer cut.

            Thanks for the effort everyone, another successful weekly release has been rolled.
            Please keep in mind code freeze is just around the corner now, get your new features and improvements in ASAP.

            Many thanks
            Sam

            Show
            Sam Hemelryk added a comment - Yarrr me 'arties, good job done. Yer code 'as landed and the weeklies ave been released with your contributions in tow. The brethren thank ya for yer 'ard work and if there'd been treasure to ave ya would ave got yer cut. Thanks for the effort everyone, another successful weekly release has been rolled. Please keep in mind code freeze is just around the corner now, get your new features and improvements in ASAP. Many thanks Sam

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: