mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
PFAHandler.php, MailboxHandler.php:
- move login() to PFAHandler.php git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1485 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
parent
8ff856df12
commit
7557ed5fae
@ -436,31 +436,6 @@ class MailboxHandler extends PFAHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to log a user in.
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @return boolean true on successful login (i.e. password matches etc)
|
||||
*/
|
||||
public function login($username, $password) {
|
||||
$username = escape_string($username);
|
||||
|
||||
$table = table_by_key($this->db_table);
|
||||
$active = db_get_boolean(True);
|
||||
$query = "SELECT password FROM $table WHERE " . $this->id_field . "='$username' AND active='$active'";
|
||||
|
||||
$result = db_query ($query);
|
||||
if ($result['rows'] == 1) {
|
||||
$row = db_array ($result['result']);
|
||||
$crypt_password = pacrypt ($password, $row['password']);
|
||||
|
||||
if($row['password'] == $crypt_password) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
# remaining comments from add():
|
||||
# FIXME: default value of $quota (-999) is intentionally invalid. Add fallback to default quota.
|
||||
# Solution: Invent an sub config class with additional informations about domain based configs like default qouta.
|
||||
|
@ -528,6 +528,32 @@ abstract class PFAHandler {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attempt to log a user in.
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @return boolean true on successful login (i.e. password matches etc)
|
||||
*/
|
||||
public function login($username, $password) {
|
||||
$username = escape_string($username);
|
||||
|
||||
$table = table_by_key($this->db_table);
|
||||
$active = db_get_boolean(True);
|
||||
$query = "SELECT password FROM $table WHERE " . $this->id_field . "='$username' AND active='$active'";
|
||||
|
||||
$result = db_query ($query);
|
||||
if ($result['rows'] == 1) {
|
||||
$row = db_array ($result['result']);
|
||||
$crypt_password = pacrypt ($password, $row['password']);
|
||||
|
||||
if($row['password'] == $crypt_password) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* functions to read protected variables
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user