Can disable MFA

This commit is contained in:
James Cole 2019-08-04 07:09:51 +02:00
parent ea52a52022
commit 616d921bef
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -231,9 +231,13 @@ class ProfileController extends Controller
*/
public function deleteCode()
{
die('this method is deprecated.');
app('preferences')->delete('twoFactorAuthEnabled');
app('preferences')->delete('twoFactorAuthSecret');
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
/** @var User $user */
$user = auth()->user();
$repository->setMFACode($user, null);
session()->flash('success', (string)trans('firefly.pref_two_factor_auth_disabled'));
session()->flash('info', (string)trans('firefly.pref_two_factor_auth_remove_it'));
@ -413,6 +417,9 @@ class ProfileController extends Controller
session()->flash('success', (string)trans('firefly.saved_preferences'));
app('preferences')->mark();
// make sure MFA is logged out.
Google2FA::logout();
return redirect(route('profile.index'));
}