mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 06:54:36 -04: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');
|
$secret = request()->input('secret');
|
||||||
$oneTimePassword = request()->input('one_time_password');
|
$oneTimePassword = request()->input('one_time_password');
|
||||||
|
|
||||||
if (! $secret || ! $google2fa->verifyKey($secret, $oneTimePassword)) {
|
if($google2fa->verifyKey($secret, $oneTimePassword) && $user->phone && $user->confirmed){
|
||||||
return response()->json('message' > ctrans('texts.invalid_one_time_password'));
|
|
||||||
} elseif (! $user->google_2fa_secret && $user->phone && $user->confirmed) {
|
|
||||||
$user->google_2fa_secret = encrypt($secret);
|
$user->google_2fa_secret = encrypt($secret);
|
||||||
$user->save();
|
$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',
|
'zoho' => 'Zoho',
|
||||||
'accounting' => 'Accounting',
|
'accounting' => 'Accounting',
|
||||||
'required_files_missing' => 'Please provide all CSVs.',
|
'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;
|
return $LANG;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user