Beispiel #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");
 }
Beispiel #2
0
 /**
  * Get the User's email address
  *
  * @return string
  */
 public function email()
 {
     return Email::fromNative($this->email);
 }
Beispiel #3
0
 /** @test */
 public function should_create_from_native()
 {
     $email = Email::fromNative('*****@*****.**');
     $this->assertInstanceOf('Cribbb\\Domain\\Model\\Identity\\Email', $email);
 }