Skip to content

Commit

Permalink
Множественные email и phone у пользователей
Browse files Browse the repository at this point in the history
  • Loading branch information
skeeks-semenov committed Jan 29, 2022
1 parent 76369d3 commit 247a57c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@ public function onAuthSuccess($client)
//Если соц сеть вернула нам email то на него можно опираться.
if ($emailFromAuthClient = ArrayHelper::getValue($attributes, 'email')) {
//Нашли email
$userEmailModel = CmsUserEmail::find()->where(['value' => $emailFromAuthClient])
$userEmailModel = CmsUserEmail::find()->cmsSite()->where(['value' => $emailFromAuthClient])
//->andWhere(['approved' => Cms::BOOL_Y])
->one();
if ($userEmailModel) {
if ($userEmailModel->user) {
$user = $userEmailModel->user;
if ($userEmailModel->cmsUser) {
$user = $userEmailModel->cmsUser;
}
}

if (!$user) {
$user = CmsUser::find()->where(['email' => $emailFromAuthClient])->one();
$user = CmsUser::find()->cmsSite()->email($emailFromAuthClient)->one();
}
}

Expand Down

0 comments on commit 247a57c

Please sign in to comment.