First step in improving test coverage.

This commit is contained in:
James Cole
2018-08-30 20:58:07 +02:00
parent e158b9b64e
commit 33fe6dbfa3
19 changed files with 517 additions and 29 deletions

View File

@@ -190,17 +190,10 @@ class ProfileController extends Controller
/**
* Enable 2FA screen.
*
* @param UserRepositoryInterface $repository
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function enable2FA(UserRepositoryInterface $repository)
public function enable2FA()
{
/** @var User $user */
$user = auth()->user();
if ($repository->hasRole($user, 'demo')) {
return redirect(route('profile.index'));
}
$hasSecret = (null !== app('preferences')->get('twoFactorAuthSecret'));
// if we don't have a valid secret yet, redirect to the code page to get one.