Fix exception when no 2FA token is entered when enabling or disabling

This commit is contained in:
Dane Everitt
2018-02-18 13:15:10 -06:00
parent 59cec6cd4b
commit 50809cad36
2 changed files with 6 additions and 2 deletions

View File

@@ -107,7 +107,7 @@ class SecurityController extends Controller
public function setTotp(Request $request)
{
try {
$this->toggleTwoFactorService->handle($request->user(), $request->input('token'));
$this->toggleTwoFactorService->handle($request->user(), $request->input('token') ?? '');
return response('true');
} catch (TwoFactorAuthenticationTokenInvalid $exception) {
@@ -127,7 +127,7 @@ class SecurityController extends Controller
public function disableTotp(Request $request)
{
try {
$this->toggleTwoFactorService->handle($request->user(), $request->input('token'), false);
$this->toggleTwoFactorService->handle($request->user(), $request->input('token') ?? '', false);
} catch (TwoFactorAuthenticationTokenInvalid $exception) {
$this->alert->danger(trans('base.security.2fa_disable_error'))->flash();
}