summaryrefslogtreecommitdiff
path: root/protected/components/UserIdentity.php
diff options
context:
space:
mode:
Diffstat (limited to 'protected/components/UserIdentity.php')
-rw-r--r--protected/components/UserIdentity.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/protected/components/UserIdentity.php b/protected/components/UserIdentity.php
index e506ef8..280515c 100644
--- a/protected/components/UserIdentity.php
+++ b/protected/components/UserIdentity.php
@@ -5,17 +5,14 @@
* It contains the authentication method that checks if the provided
* data can identity the user.
*/
-class UserIdentity extends CUserIdentity
-{
+class UserIdentity extends CUserIdentity {
public $id;
- public $isAdmin;
/**
* Authenticates a user.
*
* @return boolean whether authentication succeeds.
*/
- public function authenticate()
- {
+ public function authenticate() {
$user = User::model()->find('LOWER(username)=?', array(strtolower($this->username)));
if ($user === null){
$this->errorCode = self::ERROR_USERNAME_INVALID;
@@ -28,9 +25,15 @@ class UserIdentity extends CUserIdentity
$verein = Verein::model()->find('LOWER(slug)=?', array(strtolower($this->username)));
if (null !== $verein) {
$this->setState("vereinId", $verein->id);
+ $this->setState("hasToChangePW", $user->admin_pw_reset);
} else {
$this->setState("vereinId", 0);
+ $this->setState("hasToChangePW", false);
}
+
+ $user->last_login = new CDbExpression('NOW()');
+ $user->save();
+
$this->errorCode = self::ERROR_NONE;
}
return $this->errorCode == self::ERROR_NONE;