Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Sample implementation of login action.
- * Can be used as the actual login action.
- *
- * Required parameters: email_address or mobile_number, password or temporary_login_token
- *
- */
- extract(
- PalUtils::take($ValidateFilter->getFields(),
- array(
- 'login' => null,
- 'email_address' => null,
- 'password' => null,
- 'mobile_number' => null,
- 'temporary_login_token' => null
- )));
- if (PalUtils::is_email($login)) {
- $email_address = $login;
- $mobile_number = null;
- } elseif (PalUtils::is_phone($login)) {
- $email_address = null;
- $mobile_number = $login;
- }
- if (isset($temporary_login_token))
- $password = $temporary_login_token;
- $user = new Users_User();
- $user->login($password, $email_address, $mobile_number);
- unset($user->password_hash); // hide the password hash
- if (class_exists('WebserviceFilter') and WebserviceFilter::isAjax())
- echo json_encode(compact('user'));
Add Comment
Please, Sign In to add comment