Yii Framework Forum: afterValidate different from yii 1.2 and 1.1.10? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

afterValidate different from yii 1.2 and 1.1.10?

#1 User is offline   amiramir 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 49
  • Joined: 09-January 12

Posted 24 March 2012 - 08:05 PM

i am using yii 1.1.10, and i want to know if its book mistake or because the yii version different

in the user model

he say to override the afterValidate()
function to encrypt the password in md5
the problem is that the afterValidate function is called even when the validate is failed
so if for example the user put not email in the email field and then the validate failed,
the password field will contain the md5 password and not the original password the user entered
so i changes the afterValidate() to beforeSave() am i right? it is because different yii version? thanks
0

#2 User is offline   Narretz 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 20-August 11

Posted 27 March 2012 - 12:28 PM

I don't think it is different.

You could check by running your app with yii 1.2 t compare. You can also check the changelogs to see if something like this has been changed.
0

#3 User is offline   amiramir 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 49
  • Joined: 09-January 12

Posted 29 March 2012 - 11:10 AM

View PostNarretz, on 27 March 2012 - 12:28 PM, said:

I don't think it is different.

You could check by running your app with yii 1.2 t compare. You can also check the changelogs to see if something like this has been changed.

so i am right? is a little 'bug' in the book?
0

#4 User is offline   salman 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 30-August 10

Posted 06 August 2012 - 03:55 AM

in ebook alot of things are missing, thats what is called incomplete tutorials with errors...

login to User model not working , i did same and repeated exactly same, this encrtion is also not working


i am using this and working fine in USER MODEL

	//this function encrypts password to md5 encryption
    	public function beforeSave()
        {
		$pass = md5($this->password);
	        $this->password = $pass;
        	return true;
        }

Good Programming is 99% Sweet and 1% Coffee
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users