Пример #1
0
 /**
  * Confirm email address
  *
  * @param $token
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  * @throws TokenInvalidException
  * @throws TokenMissingException
  */
 public function getConfirm($token)
 {
     if (!$token) {
         throw new TokenMissingException();
     }
     $user = User::whereToken($token)->first();
     if (!$user) {
         throw new TokenInvalidException();
     }
     $user->token = null;
     $user->level = 1;
     // email verified
     $user->save();
     // TODO: send a welcome email
     Flash::message('이메일 주소가 확인되었습니다. 감사합니다.');
     Auth::login($user);
     return redirect($this->redirectPath());
 }