mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Fixes for 2FA
This commit is contained in:
parent
e953647d2b
commit
05b008ca60
@ -53,13 +53,21 @@ class TwoFactorController extends BaseController
|
||||
$secret = request()->input('secret');
|
||||
$oneTimePassword = request()->input('one_time_password');
|
||||
|
||||
if (! $secret || ! $google2fa->verifyKey($secret, $oneTimePassword)) {
|
||||
return response()->json('message' > ctrans('texts.invalid_one_time_password'));
|
||||
} elseif (! $user->google_2fa_secret && $user->phone && $user->confirmed) {
|
||||
if($google2fa->verifyKey($secret, $oneTimePassword) && $user->phone && $user->confirmed){
|
||||
|
||||
$user->google_2fa_secret = encrypt($secret);
|
||||
$user->save();
|
||||
}
|
||||
|
||||
return response()->json(['message' => ctrans('texts.enabled_two_factor')], 200);
|
||||
|
||||
return response()->json(['message' => ctrans('texts.enabled_two_factor')], 200);
|
||||
} elseif (! $secret || ! $google2fa->verifyKey($secret, $oneTimePassword)) {
|
||||
|
||||
return response()->json(['message' => ctrans('texts.invalid_one_time_password')]);
|
||||
|
||||
}
|
||||
|
||||
return response()->json(['message' => 'No phone record or user is not confirmed']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4167,6 +4167,9 @@ $LANG = array(
|
||||
'zoho' => 'Zoho',
|
||||
'accounting' => 'Accounting',
|
||||
'required_files_missing' => 'Please provide all CSVs.',
|
||||
'migration_auth_label' => 'Let\'s continue by authenticating.',
|
||||
'api_secret' => 'API secret',
|
||||
'migration_api_secret_notice' => 'You can find API_SECRET in the .env file or Invoice Ninja v5. If property is missing, leave field blank.',
|
||||
);
|
||||
|
||||
return $LANG;
|
||||
|
Loading…
Reference in New Issue
Block a user