forked from Public/pics
Authentication: replace getUserId with Member::fromEmailAddress
This commit is contained in:
@@ -73,22 +73,6 @@ class Authentication
|
||||
return $hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the user id belonging to a certain emailaddress.
|
||||
*/
|
||||
public static function getUserId($emailaddress)
|
||||
{
|
||||
$res = Registry::get('db')->queryValue('
|
||||
SELECT id_user
|
||||
FROM users
|
||||
WHERE emailaddress = {string:emailaddress}',
|
||||
[
|
||||
'emailaddress' => $emailaddress,
|
||||
]);
|
||||
|
||||
return empty($res) ? false : $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies whether the user is currently logged in.
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
class Member extends User
|
||||
{
|
||||
private function __construct($data)
|
||||
private function __construct($data = [])
|
||||
{
|
||||
foreach ($data as $key => $value)
|
||||
$this->$key = $value;
|
||||
@@ -18,6 +18,15 @@ class Member extends User
|
||||
$this->is_admin = $this->is_admin == 1;
|
||||
}
|
||||
|
||||
public static function fromEmailAddress($email_address)
|
||||
{
|
||||
return Registry::get('db')->queryObject(static::class, '
|
||||
SELECT *
|
||||
FROM users
|
||||
WHERE emailaddress = {string:email_address}',
|
||||
['email_address' => $email_address]);
|
||||
}
|
||||
|
||||
public static function fromId($id_user)
|
||||
{
|
||||
$row = Registry::get('db')->queryAssoc('
|
||||
|
||||
Reference in New Issue
Block a user