summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-05-06 15:45:28 +0200
committeremkael <emkael@tlen.pl>2016-05-06 15:45:28 +0200
commit257109251802053252633c5c8f2cc3cdf22dc983 (patch)
tree2d98a3073351ed406bc9d0ff9f9bd1523f2a52a0 /app
parenta43e887c380fc414121792658136a34051526b6a (diff)
* factoring user lookups by login out to user facade
Diffstat (limited to 'app')
-rw-r--r--app/php/facades/UserFacade.php4
-rw-r--r--app/php/user/DbUser.php6
2 files changed, 7 insertions, 3 deletions
diff --git a/app/php/facades/UserFacade.php b/app/php/facades/UserFacade.php
index 696f77f..c09032c 100644
--- a/app/php/facades/UserFacade.php
+++ b/app/php/facades/UserFacade.php
@@ -26,6 +26,10 @@ class UserFacade extends Facade {
return new TimezoneDTO(date_default_timezone_get());
}
+ public function findByLogin($login) {
+ return User::finder()->findByLogin($login);
+ }
+
public function checkForUsername($login) {
return !User::finder()->countByLogin($login);
}
diff --git a/app/php/user/DbUser.php b/app/php/user/DbUser.php
index ce4da4c..d636e8b 100644
--- a/app/php/user/DbUser.php
+++ b/app/php/user/DbUser.php
@@ -14,13 +14,13 @@ class DbUser extends TDbUser {
public function getDbRecord() {
if (!$this->_record) {
- $this->_record = User::finder()->findByLogin($this->Name);
+ $this->_record = UserFacade::getInstance()->findByLogin($this->Name);
}
return $this->_record;
}
public function createUser($username) {
- $dbUser = User::finder()->findByLogin($username);
+ $dbUser = UserFacade::getInstance()->findByLogin($username);
if (!$dbUser) {
return NULL;
}
@@ -35,7 +35,7 @@ class DbUser extends TDbUser {
}
public function validateUser($login, $password) {
- $user = User::finder()->findByLogin($login);
+ $user = UserFacade::getInstance()->findByLogin($login);
$dbPassword = $user ? $user->Password : '';
if (UserFacade::getInstance()->verifyPassword($password, $dbPassword)
&& $user) {