Skip to content

Commit

Permalink
fix issue with registration via email and useUsername=false (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
amnah committed Jan 26, 2016
1 parent da5fa76 commit ded8b30
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions controllers/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ public function actionLoginCallback($token)

// load post data
$post = Yii::$app->request->post();
if ($userToken && $user->load($post)) {
$userLoaded = $user->load($post);
$profileLoaded = $profile->load($post);
if ($userToken && ($userLoaded || $profileLoaded)) {

// ensure that email is taken from the $userToken (and not from user input)
$user->email = $userToken->data;

// validate and register
$profile->load($post);
if ($user->validate() && $profile->validate()) {
$role = $this->module->model("Role");
$user->setRegisterAttributes($role::ROLE_USER, $user::STATUS_ACTIVE)->save();
Expand Down

0 comments on commit ded8b30

Please sign in to comment.