For this example, the passwords are stored in the database as md5 hash.
You may be required to change the password encoding scheme.
Edit the authenticate method in ../my_app/protected/components/
public function authenticate()
{
//$users=array(
// username => password
//'demo'=>'demo',
//'admin'=>'admin',
//);
$user = myUsersTable::model()->
if ($user===null) { // No user was found!
$this->errorCode=self::ERROR_
}
// $user->Password refers to the "password" column name from the database
else if($user->Password !== md5("my_salt1".$this->
{
$this->errorCode=self::ERROR_
}
else { // User/pass match
$this->errorCode=self::ERROR_
}
return !$this->errorCode;
}
Enter the username/password pair on the login page and you should be good to go.
4 comments:
Great article, thank you very much!
What ia "mysalt1"???
It is the MD5 'salt'. It is a random string which makes the md5 hash harder to reverse engineer. The longer the random salt string, the harder it is to break.
This is good. But, can you please explain the procedure to store the newly created password or newly edited password that gets stored in the database.
Post a Comment