Esempio n. 1
0
 /**
  * Reset a user's password
  *
  * @param string $email
  * @param string $password
  * @param string $code
  * @return User;
  */
 public function reset($email, $password, $code)
 {
     if ($this->check($email, $code)) {
         $user = $this->findUserByEmail(Email::fromNative($email));
         $password = $this->hasher->hash(new Password($password));
         $user->resetPassword($password);
         $this->users->update($user);
         $this->reminders->deleteReminderByCode(ReminderCode::fromNative($code));
         return $user;
     }
     throw new InvalidValueException("{$code} is not a valid reminder code");
 }