Add code for 2FA w/oauth
This commit is contained in:
parent
98f29249fd
commit
0d4e784bff
1 changed files with 11 additions and 0 deletions
|
|
@ -261,6 +261,17 @@ class AccountApiController extends BaseAPIController
|
|||
$oAuth = new OAuth();
|
||||
$user = $oAuth->getProvider($provider)->getTokenResponse($token);
|
||||
|
||||
/*
|
||||
if ($user->google_2fa_secret && strpos($request->token_name, 'invoice-ninja-') !== false) {
|
||||
$secret = \Crypt::decrypt($user->google_2fa_secret);
|
||||
if (! $request->one_time_password) {
|
||||
return $this->errorResponse(['message' => 'OTP_REQUIRED'], 401);
|
||||
} elseif (! \Google2FA::verifyKey($secret, $request->one_time_password)) {
|
||||
return $this->errorResponse(['message' => 'Invalid one time password'], 401);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if ($user) {
|
||||
Auth::login($user);
|
||||
return $this->processLogin($request);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue