data/ 0000775 0000764 0000764 00000000000 11220610331 011646 5 ustar sakurai sakurai data/test.db 0000664 0000764 0000764 00000006000 11220610331 013130 0 ustar sakurai sakurai SQLite format 3 @ ! P++Ytablesqlite_sequencesqlite_sequenceCREATE TABLE sqlite_sequence(name,seq)k9tableUserUserCREATE TABLE User ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, username VARCHAR(128) NOT NULL, password VARCHAR(128) NOT NULL, email VARCHAR(128) NOT NULL, profile TEXT ) User data/sql 0000664 0000764 0000764 00000000521 11220123767 012402 0 ustar sakurai sakurai BEGIN TRANSACTION; DROP TABLE User; DELETE FROM sqlite_sequence; INSERT INTO "sqlite_sequence" VALUES('User',0); CREATE TABLE User ( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, username VARCHAR(128) NOT NULL, password VARCHAR(128) NOT NULL, email VARCHAR(128) NOT NULL, profile TEXT ); COMMIT; modules/ 0000775 0000764 0000764 00000000000 11220576176 012427 5 ustar sakurai sakurai modules/simpleLogin/ 0000775 0000764 0000764 00000000000 11220366717 014707 5 ustar sakurai sakurai modules/simpleLogin/models/ 0000775 0000764 0000764 00000000000 11220366717 016172 5 ustar sakurai sakurai modules/simpleLogin/models/MLoginForm.php 0000664 0000764 0000764 00000003554 11220366717 020723 0 ustar sakurai sakurai 'login, register'), array('passwordRepeat, email, profile', 'required', 'on'=>'register'), // password needs to be authenticated array('password', 'authenticate', 'on'=>'login'), array('passwordRepeat', 'compare', 'compareAttribute'=>'password', 'on'=>'register'), array('email', 'email'), ); } /** * Declares attribute labels. */ public function attributeLabels() { return array( 'rememberMe'=>'Remember me next time', ); } /** * Authenticates the password. * This is the 'authenticate' validator as declared in rules(). */ public function authenticate($attribute,$params) { if(!$this->hasErrors()) // we only want to authenticate when no input errors { $identity=new MUserIdentity($this->username,$this->password); $identity->authenticate(); switch($this->errorCode = $identity->errorCode) { case MUserIdentity::ERROR_NONE: $duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days Yii::app()->user->login($identity,$duration); break; case MUserIdentity::USER_TO_BE_REGISTERED: break; default: // UserIdentity::ERROR_PASSWORD_INVALID $this->addError('password','Password is incorrect.'); break; } } } } modules/simpleLogin/models/MUser.php 0000664 0000764 0000764 00000001533 11220366717 017740 0 ustar sakurai sakurai 128), array('password','length','max'=>128), array('email','length','max'=>128), array('username, password, email', 'required'), ); } } modules/simpleLogin/components/ 0000775 0000764 0000764 00000000000 11220366717 017074 5 ustar sakurai sakurai modules/simpleLogin/components/MUserIdentity.php 0000664 0000764 0000764 00000002136 11220366717 022354 0 ustar sakurai sakurai find('LOWER(username)=?',array(strtolower($this->username))); if($user===null) { // not exist in db $this->errorCode=self::USER_TO_BE_REGISTERED; } else if(md5($this->password)!==$user->password) { // password check $this->errorCode=self::ERROR_PASSWORD_INVALID; } else { // no error $this->_id=$user->id; $this->username=$user->username; $this->errorCode=self::ERROR_NONE; } return !$this->errorCode; } /** * @return integer the ID of the user record */ public function getId() { return $this->_id; } } modules/simpleLogin/views/ 0000775 0000764 0000764 00000000000 11220366717 016044 5 ustar sakurai sakurai modules/simpleLogin/views/layouts/ 0000775 0000764 0000764 00000000000 11220366717 017544 5 ustar sakurai sakurai modules/simpleLogin/views/layouts/.yii 0000664 0000764 0000764 00000000000 11220366717 020325 0 ustar sakurai sakurai modules/simpleLogin/views/default/ 0000775 0000764 0000764 00000000000 11220375063 017462 5 ustar sakurai sakurai modules/simpleLogin/views/default/login.php 0000644 0000764 0000764 00000003467 11220576157 021322 0 ustar sakurai sakurai pageTitle=Yii::app()->name . ' - Login'; ?>
You will be registered if you have not been registered yet.
| id ?> | username ?> | email ?> | profile ?> |
This is the view content for action "action->id; ?>". The action belongs to the controller "" in the "module->id; ?>" module.
You may customize this page by editing