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
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 6 additions and 2 deletions

View file

@ -3,6 +3,10 @@ This file is a running track of new features and fixes to each version of the pa
This project follows [Semantic Versioning](http://semver.org) guidelines.
## v0.7.1 (Derelict Dermodactylus)
### Fixed
* Fixes an exception when no token is entered on the 2-Factor enable/disable page and the form is submitted.
## v0.7.0 (Derelict Dermodactylus)
### Fixed
* `[rc.2]` — Fixes bad API behavior on `/user` routes.

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