mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Allow for logging in via email address
Accept both user names and email addresses in the login prompt. Suggested-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
c5014b0752
commit
ee9a8f232b
3 changed files with 17 additions and 2 deletions
|
@ -466,6 +466,21 @@ function uid_from_username($username) {
|
|||
return $row[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue