This commit is contained in:
Maxime Renou 2020-05-11 18:28:00 +02:00
parent d47b8961ce
commit 17d4fd2306
1 changed files with 7 additions and 3 deletions

View File

@ -201,11 +201,15 @@ class Connect
$connect_data['expires_at'] = $expires_at->addSeconds($connect_data['expires_in']); $connect_data['expires_at'] = $expires_at->addSeconds($connect_data['expires_in']);
$model_data = $this->getUserData($connect_data['access_token']); $model_data = $this->getUserData($connect_data['access_token']);
$model = config('bconnect.model');
$this->sync('User', $model_data['id']); $user = $model::where('email', $model_data['email'])->first() ?? new $model;
$user->fill($model_data);
$model = $this->synchronized['User']; if (in_array($model, $this->synchronized))
$user = $model::findOrFail($model_data['id']); $user->id = $model_data['id'];
$user->save();
$this->updateUserConnectData($user, $connect_data); $this->updateUserConnectData($user, $connect_data);