Skip to content
Snippets Groups Projects
Commit 0e88dd1a authored by Peter Rotich's avatar Peter Rotich
Browse files

Ensure the email doesn't already exist before creating it.

parent 12da45f9
No related branches found
No related tags found
No related merge requests found
...@@ -84,8 +84,9 @@ class User extends UserModel { ...@@ -84,8 +84,9 @@ class User extends UserModel {
'name'=>$data['name'], 'name'=>$data['name'],
'created'=>new SqlFunction('NOW'), 'created'=>new SqlFunction('NOW'),
'updated'=>new SqlFunction('NOW'), 'updated'=>new SqlFunction('NOW'),
'default_email'=> //XXX: Do plain create once the cause
UserEmail::create(array('address'=>$data['email'])) // of the detached emails is fixed.
'default_email' => UserEmail::ensure($data['email'])
)); ));
$user->save(true); $user->save(true);
$user->emails->add($user->default_email); $user->emails->add($user->default_email);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment