Check user is confirmed for 2FA

This commit is contained in:
Hillel Coren 2017-11-05 11:54:32 +02:00
parent c39f57fcb5
commit 5083d44b0a
2 changed files with 16 additions and 15 deletions

View File

@ -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();

View File

@ -50,6 +50,7 @@
!!}
@endif
@if ($user->confirmed)
@if ($user->google_2fa_secret)
{!! Former::checkbox('enable_two_factor')
->help(trans('texts.enable_two_factor_help'))
@ -63,7 +64,7 @@
{!! 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'))