Guest User

Untitled

a guest
May 28th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. * Sample implementation of login action.
  5. * Can be used as the actual login action.
  6. *
  7. * Required parameters: email_address or mobile_number, password or temporary_login_token
  8. *
  9. */
  10.  
  11. extract(
  12. PalUtils::take($ValidateFilter->getFields(),
  13. array(
  14. 'login' => null,
  15. 'email_address' => null,
  16. 'password' => null,
  17. 'mobile_number' => null,
  18. 'temporary_login_token' => null
  19. )));
  20.  
  21. if (PalUtils::is_email($login)) {
  22. $email_address = $login;
  23. $mobile_number = null;
  24. } elseif (PalUtils::is_phone($login)) {
  25. $email_address = null;
  26. $mobile_number = $login;
  27. }
  28.  
  29. if (isset($temporary_login_token))
  30. $password = $temporary_login_token;
  31.  
  32. $user = new Users_User();
  33. $user->login($password, $email_address, $mobile_number);
  34. unset($user->password_hash); // hide the password hash
  35.  
  36. if (class_exists('WebserviceFilter') and WebserviceFilter::isAjax())
  37. echo json_encode(compact('user'));
Add Comment
Please, Sign In to add comment