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

Same email address used to create a auth_oauth user and linked to another user moodle's account produce a Error: mdb->get_record() found more than one record

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 3.3
    • 3.3
    • Authentication
    • MOODLE_33_STABLE
    • MOODLE_33_STABLE
    • MDL-58774-master
    • Hide
      1. Setup and enable the oauth2 authentication plugin with at least one working oauth2 provider.
      2. Login as any user on your site. Link an oauth2 login to this user (preferences -> linked logins).
      3. Login as someone else
        1. verify you cannot link the same oauth2 login to this user (because it's already linked to the other user).
      4. Login as admin and delete the first user.
      5. Login as the second user and link the login again
        1. Confirm that this time it should work
      6. Add a second provider where you have the same username (You can do this with a Two Google providers, or a Google and a Facebook provider)
      7. Attempt to link the second provider for the second user
        1. Confirm that you were able to
        2. Confirm that you are able to log into your account via either provider
      Show
      Setup and enable the oauth2 authentication plugin with at least one working oauth2 provider. Login as any user on your site. Link an oauth2 login to this user (preferences -> linked logins). Login as someone else verify you cannot link the same oauth2 login to this user (because it's already linked to the other user). Login as admin and delete the first user. Login as the second user and link the login again Confirm that this time it should work Add a second provider where you have the same username (You can do this with a Two Google providers, or a Google and a Facebook provider) Attempt to link the second provider for the second user Confirm that you were able to Confirm that you are able to log into your account via either provider

    Description

      Discovered while testing MDLQA-10978

      I've created an oauth user with email user@gmail.com, and I've later linked that same user@gmail.com account to another site user. When I log into the site using user@gmail.com google account I see the following debugging message:

      Error: mdb->get_record() found more than one record!
      line 1570 of /lib/dml/moodle_database.php: call to debugging()
      line 1530 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
      line 1509 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      line 832 of /lib/classes/persistent.php: call to moodle_database->get_record()
      line 79 of /auth/oauth2/classes/api.php: call to core\persistent::get_record()
      line 397 of /auth/oauth2/classes/auth.php: call to auth_oauth2\api::match_username_to_user()
      line 45 of /auth/oauth2/login.php: call to auth_oauth2\auth->complete_login()
      

      Attachments

        Issue Links

          Activity

            People

              damyon Damyon Wiese
              dmonllao David Monllaó
              Ryan Wyllie Ryan Wyllie
              David Monllaó David Monllaó
              John Okely John Okely
              Jake Dallimore, Mathew May, Mihail Geshoski
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/May/17