Beispiel #1
0
 /**
  * Authenticate login credentials
  */
 public function authenticate($email, $password)
 {
     $user = Users::findFirst('emailAddress = "' . $email . '"');
     if (empty($user)) {
         return false;
     }
     $salt = $user->salt;
     $hash = $user->hash;
     $password = $salt . $password;
     $isPasswordOk = validate_password($password, $hash);
     if (!$isPasswordOk) {
         return false;
     }
     return $user;
 }