diff --git a/model/MailboxHandler.php b/model/MailboxHandler.php index 47c73927..4057a474 100644 --- a/model/MailboxHandler.php +++ b/model/MailboxHandler.php @@ -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. diff --git a/model/PFAHandler.php b/model/PFAHandler.php index 0c6b3dad..6433417e 100644 --- a/model/PFAHandler.php +++ b/model/PFAHandler.php @@ -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 */