Skip to content

Commit 50809ca

Browse files
committed
Fix exception when no 2FA token is entered when enabling or disabling
1 parent 59cec6c commit 50809ca

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ This file is a running track of new features and fixes to each version of the pa
33

44
This project follows [Semantic Versioning](http://semver.org) guidelines.
55

6+
## v0.7.1 (Derelict Dermodactylus)
7+
### Fixed
8+
* Fixes an exception when no token is entered on the 2-Factor enable/disable page and the form is submitted.
9+
610
## v0.7.0 (Derelict Dermodactylus)
711
### Fixed
812
* `[rc.2]` — Fixes bad API behavior on `/user` routes.

app/Http/Controllers/Base/SecurityController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function generateTotp(Request $request)
107107
public function setTotp(Request $request)
108108
{
109109
try {
110-
$this->toggleTwoFactorService->handle($request->user(), $request->input('token'));
110+
$this->toggleTwoFactorService->handle($request->user(), $request->input('token') ?? '');
111111

112112
return response('true');
113113
} catch (TwoFactorAuthenticationTokenInvalid $exception) {
@@ -127,7 +127,7 @@ public function setTotp(Request $request)
127127
public function disableTotp(Request $request)
128128
{
129129
try {
130-
$this->toggleTwoFactorService->handle($request->user(), $request->input('token'), false);
130+
$this->toggleTwoFactorService->handle($request->user(), $request->input('token') ?? '', false);
131131
} catch (TwoFactorAuthenticationTokenInvalid $exception) {
132132
$this->alert->danger(trans('base.security.2fa_disable_error'))->flash();
133133
}

0 commit comments

Comments
 (0)