Example #1
0
 protected function getEntity()
 {
     // Entity will be loaded using the provided username
     $identifier = $this->getPayload('user');
     // ... attempt to load the user by username
     $entity = $this->repo->getByUsernameOrEmail($identifier);
     // ... then return it
     return $entity;
 }
Example #2
0
 protected function getEntity()
 {
     // Entity will be loaded using the provided email
     $email = $this->getPayload('email');
     // ... attempt to load the user by email
     $entity = $this->repo->getByEmail($email);
     // ... then return it
     return $entity;
 }
Example #3
0
 public function interact()
 {
     $token = $this->getPayload('token');
     // Check if the reset token is valid
     if ($this->repo->isValidResetToken($token)) {
         // If its valid..
         // Change the password
         $password = $this->getPayload('password');
         $this->repo->setPassword($token, $password);
         // And delete the token
         $this->repo->deleteResetToken($token);
     } else {
         // Otherwise throw an exception
         throw new ValidatorException('Invalid or expired token', ['Invalid or expired reset token']);
     }
     // Return an empty success response regardless
     // if the user was found or not
     return;
 }