예제 #1
0
 /**
  * Reset a user's password
  *
  * @param string $email
  * @param string $password
  * @param string $code
  * @throws InvalidValueException
  * @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");
 }
예제 #2
0
파일: UserStub.php 프로젝트: Evyy/cffs-api
 public static function create()
 {
     //        return 'here';
     $faker = Factory::create();
     $identifier = UserId::generate();
     $email = Email::fromNative($faker->email);
     $first = FirstName::fromNative($faker->word);
     $last = LastName::fromNative($faker->word);
     $username = Username::fromNative($faker->word);
     $password = HashedPassword::fromNative(str_random(10));
     return User::create($identifier, $email, $first, $last, $username, $password);
 }
예제 #3
0
파일: EmailTest.php 프로젝트: Evyy/cffs-api
 /** @test */
 public function should_create_from_native()
 {
     $email = Email::fromNative('*****@*****.**');
     $this->assertInstanceOf('Cffs\\Domain\\Model\\Identity\\Email', $email);
 }
예제 #4
0
 /**
  * Create a new instance from a native form
  *
  * @param mixed $email
  * @param mixed $password
  * @return ValueObject
  */
 public static function fromNative($email, $password)
 {
     return new Credentials(Email::fromNative($email), Password::fromNative($password));
 }
예제 #5
0
파일: User.php 프로젝트: Evyy/cffs-api
 /**
  * Get the User's email
  *
  * @return string
  */
 public function email()
 {
     return Email::fromNative($this->email);
 }