/** * Modify the value. * * @param $value * @return bool */ public function modify($value) { if ($value == 'enable') { $twofa = new Google2FA(); return $twofa->generateSecretKey(32); } else { return $value; } }
/** * Display the dashboard for a specific user. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id = null) { if ($id == null) { $id = Auth::id(); } $user = User::find($id); if ($user == null) { abort(404); } if ($user->id != Auth::id() && !Auth::user()->can('board')) { abort(403); } $qrcode = null; $tfakey = null; if (!$user->tfa_totp_key) { $google2fa = new Google2FA(); $tfakey = $google2fa->generateSecretKey(32); $qrcode = $google2fa->getQRCodeGoogleUrl('S.A.%20Proto', str_replace(' ', '%20', $user->name), $tfakey); } $utwente = $user->getUtwenteData(); return view('users.dashboard.dashboard', ['user' => $user, 'tfa_qrcode' => $qrcode, 'tfa_key' => $tfakey, 'utwente' => $utwente]); }