diff options
Diffstat (limited to 'web/lib')
-rw-r--r-- | web/lib/acctfuncs.inc.php | 2 | ||||
-rw-r--r-- | web/lib/aur.inc.php | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/web/lib/acctfuncs.inc.php b/web/lib/acctfuncs.inc.php index ee8f0e3f..756c8477 100644 --- a/web/lib/acctfuncs.inc.php +++ b/web/lib/acctfuncs.inc.php @@ -479,7 +479,7 @@ function try_login() { } $dbh = DB::connect(); - $userID = uid_from_username($_REQUEST['user']); + $userID = uid_from_loginname($_REQUEST['user']); if (user_suspended($userID)) { $login_error = __('Account suspended'); diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php index 7d659132..9015ae8f 100644 --- a/web/lib/aur.inc.php +++ b/web/lib/aur.inc.php @@ -467,6 +467,21 @@ function uid_from_username($username) { } /** + * Determine the user's ID in the database using a username or email address + * + * @param string $username The username or email address of an account + * + * @return string Return user ID if exists, otherwise null + */ +function uid_from_loginname($loginname) { + $uid = uid_from_username($loginname); + if (!$uid) { + $uid = uid_from_email($loginname); + } + return $uid; +} + +/** * Determine the user's ID in the database using an e-mail address * * @param string $email An e-mail address in foo@example.com format |