Login Error.

I have this code in User.php

protected function beforeSave() {

        if ($this->isNewRecord) {

			$salt = $this->generateSalt();


            $this->password = $this->hashPassword($this->password, $salt);


        return parent::beforeSave();



     * Generates the password hash.

     * @param string password

     * @return string hash


   public function checkPassword($password)


        return $this->hashPassword($password,$this->salt)===$this->password;



    public function hashPassword($password,$salt)


        return md5($salt.$password);



	protected function generateSalt()


		return md5(microtime());


So, as I create, it hashes the password, and as I login it unhashes it. But still it won’t work…

What exactly doesn’t work?

When I login, I enter the correct login details, yet it still won’t login.