function users_get_by_login($email, $password)
{
    $user = users_get_by_email($email);
    if (!$user) {
        return null;
    }
    if ($user['deleted']) {
        return null;
    }
    if (!passwords_validate_password_for_user($password, $user)) {
        return null;
    }
    return $user;
}
Beispiel #2
0
 $email = post_str('email');
 $password = post_str('password');
 $smarty->assign('email', $email);
 $ok = 1;
 #
 # required fields?
 #
 if (!strlen($email) || !strlen($password)) {
     $smarty->assign('error_missing', 1);
     $ok = 0;
 }
 #
 # user exists?
 #
 if ($ok) {
     $user = users_get_by_email($email);
     if (!$user['id']) {
         $smarty->assign('error_nouser', 1);
         $ok = 0;
     }
 }
 #
 # users deleted?
 #
 if ($ok && $user['deleted']) {
     $smarty->assign('error_deleted', 1);
     $ok = 0;
 }
 #
 # password match
 #
Beispiel #3
0
function users_get_by_login($email, $password)
{
    $user = users_get_by_email($email);
    if (!$user) {
        return null;
    }
    if ($user['deleted']) {
        return null;
    }
    if ($user['password'] != login_encrypt_password($password)) {
        return null;
    }
    return $user;
}