From a2621aeb2534eacc1e20c1e737c5a381b4744e5f Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 19 Jun 2013 17:55:47 +0700 Subject: [PATCH 01/23] Update User.php replace lastvisit with lastvisit_at --- models/User.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/models/User.php b/models/User.php index a245586..905b500 100644 --- a/models/User.php +++ b/models/User.php @@ -21,7 +21,7 @@ class User extends CActiveRecord * @var integer $superuser * @var integer $status * @var timestamp $create_at - * @var timestamp $lastvisit_at + * @var timestamp $lastvisit */ /** @@ -57,11 +57,11 @@ public function rules() array('username', 'match', 'pattern' => '/^[A-Za-z0-9_]+$/u','message' => UserModule::t("Incorrect symbols (A-z0-9).")), array('status', 'in', 'range'=>array(self::STATUS_NOACTIVE,self::STATUS_ACTIVE,self::STATUS_BANNED)), array('superuser', 'in', 'range'=>array(0,1)), - array('create_at', 'default', 'value' => date('Y-m-d H:i:s'), 'setOnEmpty' => true, 'on' => 'insert'), - array('lastvisit_at', 'default', 'value' => '0000-00-00 00:00:00', 'setOnEmpty' => true, 'on' => 'insert'), + array('create_at', 'default', 'value' => date('Y-m-d H:i:s'), 'setOnEmpty' => true, 'on' => 'insert'), + array('lastvisit', 'default', 'value' => '0000-00-00 00:00:00', 'setOnEmpty' => true, 'on' => 'insert'), array('username, email, superuser, status', 'required'), array('superuser, status', 'numerical', 'integerOnly'=>true), - array('id, username, password, email, activkey, create_at, lastvisit_at, superuser, status', 'safe', 'on'=>'search'), + array('id, username, password, email, activkey, create_at, lastvisit, superuser, status', 'safe', 'on'=>'search'), ):((Yii::app()->user->id==$this->id)?array( array('username, email', 'required'), array('username', 'length', 'max'=>20, 'min' => 3,'message' => UserModule::t("Incorrect username (length between 3 and 20 characters).")), @@ -99,7 +99,7 @@ public function attributeLabels() 'createtime' => UserModule::t("Registration date"), 'create_at' => UserModule::t("Registration date"), - 'lastvisit_at' => UserModule::t("Last visit"), + 'lastvisit' => UserModule::t("Last visit"), 'superuser' => UserModule::t("Superuser"), 'status' => UserModule::t("Status"), ); @@ -121,7 +121,7 @@ public function scopes() 'condition'=>'superuser=1', ), 'notsafe'=>array( - 'select' => 'id, username, password, email, activkey, create_at, lastvisit_at, superuser, status', + 'select' => 'id, username, password, email, activkey, create_at, lastvisit, superuser, status', ), ); } @@ -130,7 +130,7 @@ public function defaultScope() { return CMap::mergeArray(Yii::app()->getModule('user')->defaultScope,array( 'alias'=>'user', - 'select' => 'user.id, user.username, user.email, user.create_at, user.lastvisit_at, user.superuser, user.status', + 'select' => 'user.id, user.username, user.email, user.create_at, user.lastvisit, user.superuser, user.status', )); } @@ -169,7 +169,7 @@ public function search() $criteria->compare('email',$this->email,true); $criteria->compare('activkey',$this->activkey); $criteria->compare('create_at',$this->create_at); - $criteria->compare('lastvisit_at',$this->lastvisit_at); + $criteria->compare('lastvisit',$this->lastvisit); $criteria->compare('superuser',$this->superuser); $criteria->compare('status',$this->status); @@ -190,7 +190,7 @@ public function setCreatetime($value) { } public function getLastvisit() { - return strtotime($this->lastvisit_at); + return strtotime($this->lastvisit); } public function setLastvisit($value) { @@ -203,4 +203,4 @@ public function afterSave() { } return parent::afterSave(); } -} \ No newline at end of file +} From 764b7508fae0d53560b82462e4ff1d5b3ee1cac7 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 19 Jun 2013 17:58:13 +0700 Subject: [PATCH 02/23] Update WebUser.php replace lastvisit instead lastvisit_at --- components/WebUser.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/WebUser.php b/components/WebUser.php index 4a664f6..f53aa22 100644 --- a/components/WebUser.php +++ b/components/WebUser.php @@ -53,7 +53,7 @@ public function updateSession() { 'email'=>$user->email, 'username'=>$user->username, 'create_at'=>$user->create_at, - 'lastvisit_at'=>$user->lastvisit_at, + 'lastvisit'=>$user->lastvisit, ),$user->profile->getAttributes()); foreach ($userAttributes as $attrName=>$attrValue) { $this->setState($attrName,$attrValue); @@ -80,4 +80,4 @@ public function isAdmin() { return Yii::app()->getModule('user')->isAdmin(); } -} \ No newline at end of file +} From 2a915ef11fab2d1c8d37a7048474d2abc28eff96 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 19 Jun 2013 18:19:48 +0700 Subject: [PATCH 03/23] Update profile.php replace lastvisit instead lastvisit_at --- views/profile/profile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/profile/profile.php b/views/profile/profile.php index 785420e..738c83e 100644 --- a/views/profile/profile.php +++ b/views/profile/profile.php @@ -46,8 +46,8 @@ create_at; ?> - getAttributeLabel('lastvisit_at')); ?> - lastvisit_at; ?> + getAttributeLabel('lastvisit')); ?> + lastvisit; ?> getAttributeLabel('status')); ?> From b73afba298f445d9a76ca35c09a3bad251b61cc9 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 19 Jun 2013 18:22:23 +0700 Subject: [PATCH 04/23] Update index.php replace lastvisit instead lastvisit_at --- views/user/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/user/index.php b/views/user/index.php index 0715139..42a1330 100644 --- a/views/user/index.php +++ b/views/user/index.php @@ -22,6 +22,6 @@ 'value' => 'CHtml::link(CHtml::encode($data->username),array("user/view","id"=>$data->id))', ), 'create_at', - 'lastvisit_at', + 'lastvisit', ), )); ?> From 4da7e1af6034e324f35c7fc69baeab529e447b67 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 19 Jun 2013 18:34:38 +0700 Subject: [PATCH 05/23] Update view.php replace lastvisit instead lastvisit_at --- views/user/view.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/user/view.php b/views/user/view.php index b1ab778..cc3c46c 100644 --- a/views/user/view.php +++ b/views/user/view.php @@ -30,8 +30,8 @@ array_push($attributes, 'create_at', array( - 'name' => 'lastvisit_at', - 'value' => (($model->lastvisit_at!='0000-00-00 00:00:00')?$model->lastvisit_at:UserModule::t('Not visited')), + 'name' => 'lastvisit', + 'value' => (($model->lastvisit!='0000-00-00 00:00:00')?$model->lastvisit:UserModule::t('Not visited')), ) ); From 094bd1e14d9f80e04563cdae9b200a4ebfd857bf Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 19 Jun 2013 18:41:48 +0700 Subject: [PATCH 06/23] Update _search.php replace lastvisit instead lastvisit_at --- views/admin/_search.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/views/admin/_search.php b/views/admin/_search.php index 7a7d02e..264b7e5 100644 --- a/views/admin/_search.php +++ b/views/admin/_search.php @@ -31,8 +31,8 @@
- label($model,'lastvisit_at'); ?> - textField($model,'lastvisit_at'); ?> + label($model,'lastvisit'); ?> + textField($model,'lastvisit'); ?>
@@ -51,4 +51,4 @@ endWidget(); ?> -
\ No newline at end of file + From 337be693b9f931cf2dd0ac5ce96ee4c1e38561a2 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 19 Jun 2013 18:42:47 +0700 Subject: [PATCH 07/23] Update index.php replace lastvisit instead lastvisit_at --- views/admin/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/admin/index.php b/views/admin/index.php index c4706b9..df09e26 100644 --- a/views/admin/index.php +++ b/views/admin/index.php @@ -57,7 +57,7 @@ 'value'=>'CHtml::link(UHtml::markSearch($data,"email"), "mailto:".$data->email)', ), 'create_at', - 'lastvisit_at', + 'lastvisit', array( 'name'=>'superuser', 'value'=>'User::itemAlias("AdminStatus",$data->superuser)', From f08944552f3abe8845b49e8df55e19f34d53b7e3 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 19 Jun 2013 18:43:19 +0700 Subject: [PATCH 08/23] Update view.php replace lastvisit instead lastvisit_at --- views/admin/view.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/admin/view.php b/views/admin/view.php index 4f2dafe..5741485 100644 --- a/views/admin/view.php +++ b/views/admin/view.php @@ -40,7 +40,7 @@ 'email', 'activkey', 'create_at', - 'lastvisit_at', + 'lastvisit', array( 'name' => 'superuser', 'value' => User::itemAlias("AdminStatus",$model->superuser), From 5d8cec26adf9e699d3c23f53cfe5fe1480535256 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 19 Jun 2013 19:48:04 +0700 Subject: [PATCH 09/23] Update LoginController.php change data of lastvisit from date('Y-m-d H:i:s') to new CDbExpression('NOW()') --- controllers/LoginController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/LoginController.php b/controllers/LoginController.php index db03de5..34dcd52 100644 --- a/controllers/LoginController.php +++ b/controllers/LoginController.php @@ -32,8 +32,8 @@ public function actionLogin() private function lastViset() { $lastVisit = User::model()->notsafe()->findByPk(Yii::app()->user->id); - $lastVisit->lastvisit_at = date('Y-m-d H:i:s'); + $lastVisit->lastvisit_at = new CDbExpression('NOW()'); $lastVisit->save(); } -} \ No newline at end of file +} From 852c4b0f76f8f26b04c30b9477d2d8d53dd12d98 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 19 Jun 2013 19:49:57 +0700 Subject: [PATCH 10/23] Update LoginController.php --- controllers/LoginController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/LoginController.php b/controllers/LoginController.php index 34dcd52..ecc5353 100644 --- a/controllers/LoginController.php +++ b/controllers/LoginController.php @@ -32,7 +32,7 @@ public function actionLogin() private function lastViset() { $lastVisit = User::model()->notsafe()->findByPk(Yii::app()->user->id); - $lastVisit->lastvisit_at = new CDbExpression('NOW()'); + $lastVisit->lastvisit = new CDbExpression('NOW()'); $lastVisit->save(); } From 9c288ce2a19ce82c85a1077d7954b318a3c1e219 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 19 Jun 2013 19:53:37 +0700 Subject: [PATCH 11/23] Update schema.mysql.sql -change lastvisit -change tablename --- data/schema.mysql.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/data/schema.mysql.sql b/data/schema.mysql.sql index 607451d..8b15a64 100644 --- a/data/schema.mysql.sql +++ b/data/schema.mysql.sql @@ -1,11 +1,11 @@ -CREATE TABLE `tbl_users` ( +CREATE TABLE `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(20) NOT NULL, `password` varchar(128) NOT NULL, `email` varchar(128) NOT NULL, `activkey` varchar(128) NOT NULL DEFAULT '', `create_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - `lastvisit_at` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', + `lastvisit` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', `superuser` int(1) NOT NULL DEFAULT '0', `status` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), @@ -15,7 +15,7 @@ CREATE TABLE `tbl_users` ( KEY `superuser` (`superuser`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; -CREATE TABLE `tbl_profiles` ( +CREATE TABLE `profiles` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `lastname` varchar(50) NOT NULL DEFAULT '', `firstname` varchar(50) NOT NULL DEFAULT '', @@ -25,7 +25,7 @@ CREATE TABLE `tbl_profiles` ( ALTER TABLE `tbl_profiles` ADD CONSTRAINT `user_profile_id` FOREIGN KEY (`user_id`) REFERENCES `tbl_users` (`id`) ON DELETE CASCADE; -CREATE TABLE `tbl_profiles_fields` ( +CREATE TABLE `profiles_fields` ( `id` int(10) NOT NULL AUTO_INCREMENT, `varname` varchar(50) NOT NULL, `title` varchar(255) NOT NULL, @@ -47,14 +47,14 @@ CREATE TABLE `tbl_profiles_fields` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ; -INSERT INTO `tbl_users` (`id`, `username`, `password`, `email`, `activkey`, `superuser`, `status`) VALUES +INSERT INTO `users` (`id`, `username`, `password`, `email`, `activkey`, `superuser`, `status`) VALUES (1, 'admin', '21232f297a57a5a743894a0e4a801fc3', 'webmaster@example.com', '9a24eff8c15a6a141ece27eb6947da0f', 1, 1), (2, 'demo', 'fe01ce2a7fbac8fafaed7c982a04e229', 'demo@example.com', '099f825543f7850cc038b90aaff39fac', 0, 1); -INSERT INTO `tbl_profiles` (`user_id`, `lastname`, `firstname`) VALUES +INSERT INTO `profiles` (`user_id`, `lastname`, `firstname`) VALUES (1, 'Admin', 'Administrator'), (2, 'Demo', 'Demo'); -INSERT INTO `tbl_profiles_fields` (`id`, `varname`, `title`, `field_type`, `field_size`, `field_size_min`, `required`, `match`, `range`, `error_message`, `other_validator`, `default`, `widget`, `widgetparams`, `position`, `visible`) VALUES +INSERT INTO `profiles_fields` (`id`, `varname`, `title`, `field_type`, `field_size`, `field_size_min`, `required`, `match`, `range`, `error_message`, `other_validator`, `default`, `widget`, `widgetparams`, `position`, `visible`) VALUES (1, 'lastname', 'Last Name', 'VARCHAR', 50, 3, 1, '', '', 'Incorrect Last Name (length between 3 and 50 characters).', '', '', '', '', 1, 3), -(2, 'firstname', 'First Name', 'VARCHAR', 50, 3, 1, '', '', 'Incorrect First Name (length between 3 and 50 characters).', '', '', '', '', 0, 3); \ No newline at end of file +(2, 'firstname', 'First Name', 'VARCHAR', 50, 3, 1, '', '', 'Incorrect First Name (length between 3 and 50 characters).', '', '', '', '', 0, 3); From 87361629fa61139bf83f241ddea2f5c08a2fcfa9 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 19 Jun 2013 19:58:35 +0700 Subject: [PATCH 12/23] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4fa2526..7c25194 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,10 @@ Download or checkout (SVN/Git) from http://yii-user.2mx.org and unpack files in Git clone --------- - +original clone: clone git git@github.com:mishamx/yii-user.git +modified clone(command): + git clone https://github.com/prawee/yii-user.git Configure --------- From f7ee81716e054154adc39f51013f61e60df0501e Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 19 Jun 2013 19:59:20 +0700 Subject: [PATCH 13/23] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7c25194..8a7bf89 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Git clone --------- original clone: clone git git@github.com:mishamx/yii-user.git + modified clone(command): git clone https://github.com/prawee/yii-user.git From 2065a2f31054e22c16f45919b9c6d1f81a63cc8d Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 26 Jun 2013 17:49:47 +0700 Subject: [PATCH 14/23] Update UserModule.php change variable from loginNotActiv to loginNotActive --- UserModule.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UserModule.php b/UserModule.php index cc624a9..b9f305f 100644 --- a/UserModule.php +++ b/UserModule.php @@ -38,7 +38,7 @@ class UserModule extends CWebModule * @var boolean * @desc allow auth for is not active user */ - public $loginNotActiv=false; + public $loginNotActive=false; /** * @var boolean @@ -48,7 +48,7 @@ class UserModule extends CWebModule /** * @var boolean - * @desc login after registration (need loginNotActiv or activeAfterRegister = true) + * @desc login after registration (need loginNotActive or activeAfterRegister = true) */ public $autoLogin=true; From 6fa3cbef6b3a00a4be1c25331c860836865708d2 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 26 Jun 2013 17:52:24 +0700 Subject: [PATCH 15/23] Update schema.mysql.sql --- data/schema.mysql.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/schema.mysql.sql b/data/schema.mysql.sql index 8b15a64..54eb824 100644 --- a/data/schema.mysql.sql +++ b/data/schema.mysql.sql @@ -22,8 +22,8 @@ CREATE TABLE `profiles` ( PRIMARY KEY (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; -ALTER TABLE `tbl_profiles` - ADD CONSTRAINT `user_profile_id` FOREIGN KEY (`user_id`) REFERENCES `tbl_users` (`id`) ON DELETE CASCADE; +ALTER TABLE `profiles` + ADD CONSTRAINT `user_profile_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE; CREATE TABLE `profiles_fields` ( `id` int(10) NOT NULL AUTO_INCREMENT, From f7a1c2aba54adb11560eeb7b982dc14f60fafe54 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 26 Jun 2013 18:21:18 +0700 Subject: [PATCH 16/23] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a7bf89..7d54592 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Change your config main: 'sendActivationMail' => true, # allow access for non-activated users - 'loginNotActiv' => false, + 'loginNotActive' => false, # activate user on registration (only sendActivationMail = false) 'activeAfterRegister' => false, From 39c5e355856b2b761f8e96673bac2da206030887 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 26 Jun 2013 19:03:20 +0700 Subject: [PATCH 17/23] Update schema.mysql.sql --- data/schema.mysql.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/schema.mysql.sql b/data/schema.mysql.sql index 54eb824..ea35f8c 100644 --- a/data/schema.mysql.sql +++ b/data/schema.mysql.sql @@ -23,7 +23,7 @@ CREATE TABLE `profiles` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; ALTER TABLE `profiles` - ADD CONSTRAINT `user_profile_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE; + ADD CONSTRAINT `profile_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE; CREATE TABLE `profiles_fields` ( `id` int(10) NOT NULL AUTO_INCREMENT, From 88d3cbda0cf6a9185cb41cd6b0a3d3797a2b0186 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 26 Jun 2013 19:14:35 +0700 Subject: [PATCH 18/23] Update RegistrationController.php change variable from loginNotActiv to loginNotActive --- controllers/RegistrationController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/controllers/RegistrationController.php b/controllers/RegistrationController.php index 7890b65..3f885ce 100644 --- a/controllers/RegistrationController.php +++ b/controllers/RegistrationController.php @@ -54,7 +54,7 @@ public function actionRegistration() { UserModule::sendMail($model->email,UserModule::t("You registered from {site_name}",array('{site_name}'=>Yii::app()->name)),UserModule::t("Please activate you account go to {activation_url}",array('{activation_url}'=>$activation_url))); } - if ((Yii::app()->controller->module->loginNotActiv||(Yii::app()->controller->module->activeAfterRegister&&Yii::app()->controller->module->sendActivationMail==false))&&Yii::app()->controller->module->autoLogin) { + if ((Yii::app()->controller->module->loginNotActive||(Yii::app()->controller->module->activeAfterRegister&&Yii::app()->controller->module->sendActivationMail==false))&&Yii::app()->controller->module->autoLogin) { $identity=new UserIdentity($model->username,$soucePassword); $identity->authenticate(); Yii::app()->user->login($identity,0); @@ -64,7 +64,7 @@ public function actionRegistration() { Yii::app()->user->setFlash('registration',UserModule::t("Thank you for your registration. Contact Admin to activate your account.")); } elseif(Yii::app()->controller->module->activeAfterRegister&&Yii::app()->controller->module->sendActivationMail==false) { Yii::app()->user->setFlash('registration',UserModule::t("Thank you for your registration. Please {{login}}.",array('{{login}}'=>CHtml::link(UserModule::t('Login'),Yii::app()->controller->module->loginUrl)))); - } elseif(Yii::app()->controller->module->loginNotActiv) { + } elseif(Yii::app()->controller->module->loginNotActive) { Yii::app()->user->setFlash('registration',UserModule::t("Thank you for your registration. Please check your email or login.")); } else { Yii::app()->user->setFlash('registration',UserModule::t("Thank you for your registration. Please check your email.")); @@ -77,4 +77,4 @@ public function actionRegistration() { $this->render('/user/registration',array('model'=>$model,'profile'=>$profile)); } } -} \ No newline at end of file +} From 2577a46d0b21c7487b91ee1605bb1a9410296d25 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Wed, 26 Jun 2013 19:18:20 +0700 Subject: [PATCH 19/23] Update UserIdentity.php change variable from loginNotActiv to loginNotActive. --- components/UserIdentity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/UserIdentity.php b/components/UserIdentity.php index 6f8986c..cea9192 100644 --- a/components/UserIdentity.php +++ b/components/UserIdentity.php @@ -34,7 +34,7 @@ public function authenticate() } else if(Yii::app()->getModule('user')->encrypting($this->password)!==$user->password) $this->errorCode=self::ERROR_PASSWORD_INVALID; - else if($user->status==0&&Yii::app()->getModule('user')->loginNotActiv==false) + else if($user->status==0&&Yii::app()->getModule('user')->loginNotActive==false) $this->errorCode=self::ERROR_STATUS_NOTACTIV; else if($user->status==-1) $this->errorCode=self::ERROR_STATUS_BAN; @@ -53,4 +53,4 @@ public function getId() { return $this->_id; } -} \ No newline at end of file +} From fd779cd6ede2d688841141eeeb33f99e06669325 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Thu, 27 Jun 2013 19:36:03 +0700 Subject: [PATCH 20/23] Update User.php Edit setLastvisit() change $this->lastvisit_at to $this->lastvisit --- models/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/User.php b/models/User.php index 905b500..1a4a4fd 100644 --- a/models/User.php +++ b/models/User.php @@ -194,7 +194,7 @@ public function getLastvisit() { } public function setLastvisit($value) { - $this->lastvisit_at=date('Y-m-d H:i:s',$value); + $this->lastvisit=date('Y-m-d H:i:s',$value); } public function afterSave() { From a4cd7c14d3607a1b029d92661bb07f25773b4f0f Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Fri, 5 Jul 2013 04:15:02 +0700 Subject: [PATCH 21/23] Update WebUser.php Check user before update session. --- components/WebUser.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/components/WebUser.php b/components/WebUser.php index f53aa22..676a506 100644 --- a/components/WebUser.php +++ b/components/WebUser.php @@ -48,15 +48,17 @@ protected function afterLogin($fromCookie) public function updateSession() { $user = Yii::app()->getModule('user')->user($this->id); - $this->name = $user->username; - $userAttributes = CMap::mergeArray(array( - 'email'=>$user->email, - 'username'=>$user->username, - 'create_at'=>$user->create_at, - 'lastvisit'=>$user->lastvisit, - ),$user->profile->getAttributes()); - foreach ($userAttributes as $attrName=>$attrValue) { - $this->setState($attrName,$attrValue); + if($user!==false){ + $this->name = $user->username; + $userAttributes = CMap::mergeArray(array( + 'email'=>$user->email, + 'username'=>$user->username, + 'create_at'=>$user->create_at, + 'lastvisit'=>$user->lastvisit, + ),$user->profile->getAttributes()); + foreach ($userAttributes as $attrName=>$attrValue) { + $this->setState($attrName,$attrValue); + } } } From c79a70029e71ea1b24aeed38bb167e08cb862f62 Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Mon, 8 Jul 2013 10:41:01 +0700 Subject: [PATCH 22/23] Update User.php Fixed. https://github.com/SleepWalker/yii-user/commit/4f39b3e5b7ec1c793dd351ffdff649e9ccd1d593 --- models/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/User.php b/models/User.php index 1a4a4fd..97dbb26 100644 --- a/models/User.php +++ b/models/User.php @@ -198,7 +198,7 @@ public function setLastvisit($value) { } public function afterSave() { - if (get_class(Yii::app())=='CWebApplication'&&Profile::$regMode==false) { + if (get_class(Yii::app())=='CWebApplication'&&Profile::$regMode==false && !Yii::app()->user->isGuest) { Yii::app()->user->updateSession(); } return parent::afterSave(); From bee0bb4f680e5d0384e5597eace7071ad899d3aa Mon Sep 17 00:00:00 2001 From: prawee wongsa Date: Tue, 9 Jul 2013 09:22:15 +0700 Subject: [PATCH 23/23] Ignore --- .gitignore | 1 + nbproject/project.properties | 7 +++++++ nbproject/project.xml | 9 +++++++++ 3 files changed, 17 insertions(+) create mode 100644 .gitignore create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..14bc68c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/nbproject/private/ \ No newline at end of file diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 0000000..94429c9 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,7 @@ +include.path=${php.global.include.path} +php.version=PHP_53 +source.encoding=UTF-8 +src.dir=. +tags.asp=false +tags.short=true +web.root=. diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 0000000..6fddfda --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,9 @@ + + + org.netbeans.modules.php.project + + + yii-user + + +