/** * View user profile. * * @return \Illuminate\View\View */ public function index() { $user = Auth::user(); $code = $this->google2fa->generateSecretKey(); if ($user->has_two_factor_authentication || old('google_code')) { $code = old('google_code', $user->google2fa_secret); } $img = $this->google2fa->getQRCodeGoogleUrl('Deployer', $user->email, $code); return view('user.profile', ['google_2fa_url' => $img, 'google_2fa_code' => $code, 'title' => Lang::get('users.update_profile')]); }
/** * @param Google2FA $google2fa * * @return View */ public function code(Google2FA $google2fa) { $domain = $this->getDomain(); /** @noinspection PhpMethodParametersCountMismatchInspection */ $secret = $google2fa->generateSecretKey(16, auth()->user()->id); Session::flash('two-factor-secret', $secret); $image = $google2fa->getQRCodeInline('Firefly III at ' . $domain, null, $secret, 150); return view('preferences.code', compact('image')); }