function drupalgap_email_registration_services_login in DrupalGap 7
Replacement callback for the Services user login resource when the Email Registration module is enabled. Use the email address to login.
See also
1 string reference to 'drupalgap_email_registration_services_login'
- drupalgap_email_registration_services_resources_alter in modules/
drupalgap_email_registration/ drupalgap_email_registration.module - Implements hook_services_resources_alter().
File
- modules/
drupalgap_email_registration/ drupalgap_email_registration.module, line 19
Code
function drupalgap_email_registration_services_login($username, $password) {
$result = db_query("SELECT name FROM {users} WHERE LOWER(mail) = LOWER(:username)", array(
':username' => $username,
))
->fetch();
if (!empty($result->name)) {
$username = $result->name;
}
return _user_resource_login($username, $password);
}