Exemplo n.º 1
0
 private function sendEmail($user)
 {
     $token = $this->tokenHelper->setModel($user)->create($user->id . 'recovery');
     $mail_data = ['toName' => $user->username, 'toEmail' => $user->email, 'token' => $token->token];
     $this->mailer->send('v1.emails.forgot_password', $mail_data, function (Message $message) use($mail_data) {
         $message->from(config('tezol.forgot_password.form', '*****@*****.**'), config('tezol.forgot_password.fromName', 'Tezol'));
         $message->subject(config('tezol.forgot_password.subject'));
         $message->to($mail_data['toName'], $mail_data['toEmail']);
     });
     return true;
 }
Exemplo n.º 2
0
 /**
  * Handle the event.
  *
  * @param  UserRegistered  $event
  * @return void
  */
 public function handle(UserRegistered $event)
 {
     $user = $event->user;
     if (!$user['email']) {
         return;
     }
     $token = $this->tokenHelper->setModel($user)->create($user->id . 'verification');
     $mail_data = ['token' => $token->token, 'toName' => $user->username, 'toEmail' => $user->email];
     $this->mailer->send('v1.emails.verification', $mail_data, function (Message $message) use($mail_data) {
         $message->from(config('tezol.register_verification.form', '*****@*****.**'), config('tezol.register_verification.fromName', 'Tezol'));
         $message->to($mail_data['toEmail'], $mail_data['toName']);
         $message->subject(config('tezol.register_verification.subject', 'Tezol'));
     });
 }
Exemplo n.º 3
0
 public function fire(array $data)
 {
     $this->validator->setScenario('recoverPassword')->validate($data);
     $token = $this->tokenHelper->validate($data['token']);
     if ($token === false) {
         $this->response()->errorBadRequest(trans('messages.token_invalid'));
     }
     $user = $token->tokenable->first();
     if ($user === NULL) {
         $this->response()->errorBadRequest(trans('messages.token_invalid'));
     }
     $user->password = $this->hasher->make($data['password']);
     $user->save();
     $token->delete();
     return $user;
 }