예제 #1
0
 /**
  * Handle a verify email request for the application.
  *
  * @param string $token
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
  */
 public function verifyEmail($token)
 {
     if (!($account = Verify::verifyToken($token)) instanceof Account) {
         return view('errors.emailVerifyFailed', ['message' => $account]);
     }
     $account->attachRole(Role::where('name', '=', 'verified-user')->first());
     Event::_create('events.account', $account, 'account.verifyEmail');
     return redirect()->route('home');
 }
예제 #2
0
파일: Register.php 프로젝트: BePsvPT/CCU
 protected function make()
 {
     $this->expireOldTokens($this->category, $this->account->getAttribute('id'));
     $verify = Verify::create(['token' => str_random(100), 'category_id' => $this->category, 'account_id' => $this->account->getAttribute('id'), 'created_at' => Carbon::now()]);
     $this->data = ['token' => $verify->getAttribute('token')];
 }
예제 #3
0
 /**
  * Expire old verify tokens.
  *
  * @param int $categoryId
  * @param int $accountId
  * @return bool|null
  */
 protected function expireOldTokens($categoryId, $accountId)
 {
     return Verify::where('category_id', '=', $categoryId)->where('account_id', '=', $accountId)->delete();
 }