示例#1
0
 /**
  * Queue the sending of the activation email.
  *
  * @return \Illuminate\Http\Response
  */
 public function postResend()
 {
     $input = Binput::only('email');
     $val = UserRepository::validate($input, array_keys($input));
     if ($val->fails()) {
         return Redirect::route('account.resend')->withInput()->withErrors($val->errors());
     }
     $this->throttler->hit();
     try {
         $user = Credentials::getUserProvider()->findByLogin($input['email']);
         if ($user->activated) {
             return Redirect::route('account.resend')->withInput()->with('error', 'That user is already activated.');
         }
         $code = $user->getActivationCode();
         $mail = ['url' => URL::to(Config::get('core.home', '/')), 'link' => URL::route('account.activate', ['id' => $user->id, 'code' => $code]), 'email' => $user->getLogin(), 'subject' => Config::get('core.name') . ' - Activation'];
         Mail::queue('credentials::emails.resend', $mail, function ($message) use($mail) {
             $message->to($mail['email'])->subject($mail['subject']);
         });
         return Redirect::route('account.resend')->with('success', 'Check your email for your new activation email.');
     } catch (UserNotFoundException $e) {
         return Redirect::route('account.resend')->with('error', 'That user does not exist.');
     }
 }