mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Wipe OAuth data when changing email addresses
This commit is contained in:
parent
941ae136be
commit
68d56e92cb
@ -389,15 +389,18 @@ class UserController extends BaseController
|
||||
$new_user = $user->fresh();
|
||||
|
||||
/* When changing email address we store the former email in case we need to rollback */
|
||||
/* 27-10-2022 we need to wipe the oauth data at this point*/
|
||||
if ($old_user_email != $new_email) {
|
||||
$user->last_confirmed_email_address = $old_user_email;
|
||||
$user->email_verified_at = null;
|
||||
$user->oauth_user_id = null;
|
||||
$user->oauth_provider_id = null;
|
||||
$user->oauth_user_refresh_token = null;
|
||||
$user->oauth_user_token = null;
|
||||
$user->save();
|
||||
UserEmailChanged::dispatch($new_user, json_decode($old_user), auth()->user()->company());
|
||||
}
|
||||
|
||||
// $user->company_users()->update(["permissions_updated_at" => now()]);
|
||||
|
||||
event(new UserWasUpdated($user, auth()->user(), auth()->user()->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
|
||||
|
||||
return $this->itemResponse($user);
|
||||
|
Loading…
Reference in New Issue
Block a user