/**
  * The method which actually triggers the confirmation.
  *
  * @param $token
  * @param TokenRepositoryInterface $tokens
  * @param Guard $guard
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function show($token, TokenRepositoryInterface $tokens, Guard $guard)
 {
     $token = $tokens->findTokenByValue($token);
     if ($token) {
         $user = $this->dispatch(new ConfirmEmail($token));
         if ($user) {
             return redirect('admin/start');
         }
     }
     return redirect()->to(store_route('store.home'));
 }
Пример #2
0
 /**
  * @param ThemeMailer $mail
  * @param Translator $lang
  * @param TokenRepositoryInterface $tokens
  * @throws \Exception
  */
 public function handle(ThemeMailer $mail, Translator $lang, TokenRepositoryInterface $tokens)
 {
     try {
         $token = $tokens->createNewToken(Token::TYPE_CONFIRMATION, $this->user->email);
         if ($token) {
             $user = $this->user;
             $user->confirmationToken()->associate($token);
             $subject = $lang->get('users::emails.confirm-email.subject');
             $data = array_merge($this->baseData(), ['user' => $user, 'token' => $token, 'email_to' => $user->email]);
             $send = $mail->send('users::emails.confirm-email', $data, $subject);
             if ($send) {
                 $this->delete();
             }
             $user->save();
         }
     } catch (\Exception $e) {
         $this->release();
         throw $e;
     }
 }
Пример #3
0
 /**
  * @param ThemeMailer $mail
  * @param TokenRepositoryInterface $tokens
  * @param Translator $lang
  * @param UserRepositoryInterface $users
  * @throws Exception
  */
 public function handle(ThemeMailer $mail, TokenRepositoryInterface $tokens, Translator $lang, UserRepositoryInterface $users)
 {
     try {
         $user = $users->findUserByEmail($this->email);
         if ($user) {
             $token = $tokens->createNewToken(Token::TYPE_RESET, $this->email);
             $user->resetToken()->associate($token);
             $user->save();
             $subject = $lang->get('users::emails.reset-password.subject');
             $data = array_merge($this->baseData(), ['user' => $user, 'token' => $token, 'email_to' => $this->email]);
             $send = $mail->send('users::emails.reset-password', $data, $subject);
             if ($send) {
                 $this->delete();
             }
         }
     } catch (Exception $e) {
         $this->release();
         throw $e;
     }
 }