If user signs in with parent auth method first, a duplicate account is created when they SSO in

Bug #547517 reported by Nigel-catalyst
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Unassigned

Bug Description

As described in this thread: http://mahara.org/interaction/forum/topic.php?id=331

The solution, I think, is to insert a record into auth_remote_user when we are auto-creating a user who has a parent auth method.

The code for this is in login_submit. Perhaps it should go in the try/catch block around line 1230 of auth/lib.php:

                try {
                    create_user($USER, array(), $institution);
                    $USER->reanimate($USER->id, $authinstance->id);
                }
                catch (Exception $e) {
                    db_rollback();
                    throw $e;
                }

Something along the lines of

if (<db query to find authinstance(s?) with parent = $auth->id) {
   // possibly a loop here if there's more than one - can there be more than one?
   insert_record('auth_remote_user', (object)array(
      'authinstance' => $parent->id,
      'remoteusername' => $USER->username,
      'localusr' => $USER->id
   );
}

This bug was imported from eduforge.org, see:
https://eduforge.org/tracker/index.php?func=detail&aid=3190&group_id=176&atid=739

Revision history for this message
Nigel-catalyst (nigel-catalyst) wrote :

Happening to more people now..

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.