Check user is confirmed for 2FA
This commit is contained in:
parent
c39f57fcb5
commit
5083d44b0a
2 changed files with 16 additions and 15 deletions
|
|
@ -11,7 +11,7 @@ class TwoFactorController extends Controller
|
|||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user->google_2fa_secret || ! $user->phone) {
|
||||
if ($user->google_2fa_secret || ! $user->phone || ! $user->confirmed) {
|
||||
return redirect('/settings/user_details');
|
||||
}
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ class TwoFactorController extends Controller
|
|||
$user = auth()->user();
|
||||
$secret = session()->pull('2fa:secret');
|
||||
|
||||
if ($secret && ! $user->google_2fa_secret && $user->phone) {
|
||||
if ($secret && ! $user->google_2fa_secret && $user->phone && $user->confirmed) {
|
||||
$user->google_2fa_secret = Crypt::encrypt($secret);
|
||||
$user->save();
|
||||
|
||||
|
|
|
|||
|
|
@ -50,21 +50,22 @@
|
|||
!!}
|
||||
@endif
|
||||
|
||||
@if ($user->google_2fa_secret)
|
||||
{!! Former::checkbox('enable_two_factor')
|
||||
->help(trans('texts.enable_two_factor_help'))
|
||||
->text(trans('texts.enable'))
|
||||
->value(1) !!}
|
||||
@elseif ($user->phone)
|
||||
{!! Former::plaintext('enable_two_factor')->value(
|
||||
Button::primary(trans('texts.enable'))->asLinkTo(url('settings/enable_two_factor'))->small()
|
||||
)->help('enable_two_factor_help') !!}
|
||||
@else
|
||||
{!! Former::plaintext('enable_two_factor')
|
||||
->value('<span class="text-muted">' . trans('texts.set_phone_for_two_factor') . '</span>') !!}
|
||||
@if ($user->confirmed)
|
||||
@if ($user->google_2fa_secret)
|
||||
{!! Former::checkbox('enable_two_factor')
|
||||
->help(trans('texts.enable_two_factor_help'))
|
||||
->text(trans('texts.enable'))
|
||||
->value(1) !!}
|
||||
@elseif ($user->phone)
|
||||
{!! Former::plaintext('enable_two_factor')->value(
|
||||
Button::primary(trans('texts.enable'))->asLinkTo(url('settings/enable_two_factor'))->small()
|
||||
)->help('enable_two_factor_help') !!}
|
||||
@else
|
||||
{!! Former::plaintext('enable_two_factor')
|
||||
->value('<span class="text-muted">' . trans('texts.set_phone_for_two_factor') . '</span>') !!}
|
||||
@endif
|
||||
@endif
|
||||
|
||||
|
||||
{!! Former::checkbox('dark_mode')
|
||||
->help(trans('texts.dark_mode_help'))
|
||||
->text(trans('texts.enable'))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue