1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for reset password

This commit is contained in:
David Bomba 2021-05-22 14:45:09 +10:00
parent f15ac46a08
commit 601d795ace
2 changed files with 24 additions and 1 deletions

View File

@ -351,6 +351,7 @@ class LoginController extends BaseController
if (is_array($user)) {
//
$query = [
'oauth_user_id' => $google->harvestSubField($user),
'oauth_provider_id'=> 'google',
@ -384,6 +385,28 @@ class LoginController extends BaseController
return $this->timeConstrainedResponse($cu);
}
//If this is a result user/email combo - lets add their OAuth details details
if($existing_login_user = MultiDB::hasUser(['email' => $google->harvestEmail($user)]))
{
Auth::login($existing_login_user, true);
$existing_login_user->setCompany($existing_login_user->account->default_company);
$timeout = $existing_login_user->company()->default_password_timeout;
if($timeout == 0)
$timeout = 30*60*1000*1000;
else
$timeout = $timeout/1000;
Cache::put($existing_login_user->hashed_id.'_'.$existing_login_user->account_id.'_logged_in', Str::random(64), $timeout);
auth()->user()->update([
'oauth_user_id' => $google->harvestSubField($user),
'oauth_provider_id'=> 'google',
]);
}
}
if ($user) {

View File

@ -408,7 +408,7 @@ class User extends Authenticatable implements MustVerifyEmail
$nmo->settings = $this->account->default_company->settings;
$nmo->company = $this->account->default_company;
NinjaMailerJob::dispatch($nmo);
NinjaMailerJob::dispatch($nmo, true);
//$this->notify(new ResetPasswordNotification($token));
}