Advertisement
fernandezekiel

Untitled

Oct 20th, 2012
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. public function login()
  2. {
  3. if($this->_identity===null)
  4. {
  5. $this->_identity=new UserIdentity($this->username,$this->password);
  6. $this->_identity->authenticate();
  7. }
  8. if($this->_identity->errorCode===UserIdentity::ERROR_NONE)
  9. {
  10. $duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days
  11. Yii::app()->user->login($this->_identity,$duration);
  12. $userRecord = new Userrecord; // replace with proper name
  13. $userRecord->username = $this->username;
  14. $userRecord->save();
  15. return true;
  16. }
  17. else
  18. return false;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement