/**
  * Return an HTML mailto link.
  *
  * @param null|string $text
  * @return null|string
  */
 public function qr_code()
 {
     if (!($user = $this->object->getEntry())) {
         return null;
     }
     $twofa = new Google2FA();
     $url = $twofa->getQRCodeGoogleUrl('The%20Linden%20Tree', $user->email, $this->object->getValue());
     return $this->html->image($url);
 }
Exemplo n.º 2
0
 /**
  * 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]);
 }