mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for 2FA
This commit is contained in:
parent
114b511118
commit
18a038a34d
@ -94,16 +94,13 @@ class TwilioController extends BaseController
|
|||||||
|
|
||||||
if($verification_check->status == 'approved'){
|
if($verification_check->status == 'approved'){
|
||||||
|
|
||||||
if($request->query('validate_only') == 'true')
|
|
||||||
return response()->json(['message' => 'SMS verified'], 200);
|
|
||||||
|
|
||||||
|
|
||||||
$account->account_sms_verified = true;
|
$account->account_sms_verified = true;
|
||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
//on confirmation we set the users phone number.
|
//on confirmation we set the users phone number.
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
$user->phone = $account->account_sms_verification_number;
|
$user->phone = $account->account_sms_verification_number;
|
||||||
|
$user->verified_phone_number = true;
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
return response()->json(['message' => 'SMS verified'], 200);
|
return response()->json(['message' => 'SMS verified'], 200);
|
||||||
@ -126,7 +123,6 @@ class TwilioController extends BaseController
|
|||||||
|
|
||||||
$twilio = new Client($sid, $token);
|
$twilio = new Client($sid, $token);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$verification = $twilio->verify
|
$verification = $twilio->verify
|
||||||
->v2
|
->v2
|
||||||
@ -167,9 +163,11 @@ class TwilioController extends BaseController
|
|||||||
"code" => $request->code
|
"code" => $request->code
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
if($verification_check->status == 'approved'){
|
if($verification_check->status == 'approved'){
|
||||||
|
|
||||||
|
if($request->query('validate_only') == 'true')
|
||||||
|
return response()->json(['message' => 'SMS verified'], 200);
|
||||||
|
|
||||||
$user->google_2fa_secret = '';
|
$user->google_2fa_secret = '';
|
||||||
$user->sms_verification_code = '';
|
$user->sms_verification_code = '';
|
||||||
$user->save();
|
$user->save();
|
||||||
|
@ -65,8 +65,9 @@ class UpdateUserRequest extends Request
|
|||||||
$input['last_name'] = strip_tags($input['last_name']);
|
$input['last_name'] = strip_tags($input['last_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(array_key_exists('phone', $input) && isset($input['phone']) && strlen($input['phone']) > 1 && ($this->user->phone != $input['phone']))
|
if(array_key_exists('phone', $input) && isset($input['phone']) && strlen($input['phone']) > 1 && ($this->user->phone != $input['phone'])){
|
||||||
$this->phone_has_changed = true;
|
$this->phone_has_changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(array_key_exists('oauth_provider_id', $input) && $input['oauth_provider_id'] == '')
|
if(array_key_exists('oauth_provider_id', $input) && $input['oauth_provider_id'] == '')
|
||||||
$input['oauth_user_id'] = '';
|
$input['oauth_user_id'] = '';
|
||||||
|
@ -68,7 +68,7 @@ class HasValidPhoneNumber implements Rule
|
|||||||
|
|
||||||
request()->merge(['validated_phone' => $phone_number->phoneNumber ]);
|
request()->merge(['validated_phone' => $phone_number->phoneNumber ]);
|
||||||
|
|
||||||
$user->verified_phone_number = true;
|
$user->verified_phone_number = false;
|
||||||
$user->save();
|
$user->save();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user