Yii Framework Forum: Dumb Newbie Need Password Hashing Help - Yii Framework Forum

Jump to content

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

Dumb Newbie Need Password Hashing Help Rate Topic: -----

#1 User is offline   stickdog 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 29-April 10

Posted 10 May 2010 - 05:41 PM

I'm trying to develop a simple set of screens for an admin to use to maintain users.

I've put in srbac.

I've got a user table with user id, user name, password and salt fields.

I've put in the public functions validatePassword($password), hashPassword($password,$salt), & generateSalt()

I know I need to generateSalt, then hash the user entered password before I save it.

Where should I do this? In beforeSave? Should I put beforeSave in the model or the controller? What does the code look like? Is there any place where I can see a functional snippet of this code? Am I missing something simple (as usual)?

Thanks!
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,358
  • Joined: 12-October 09
  • Location:Croatia

Posted 11 May 2010 - 02:06 AM

Take a look at the Yii blog tutorial - http://www.yiiframew.../start.overview

Yii blog tutorial, authenticating user - http://www.yiiframew.../prototype.auth
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   stickdog 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 27
  • Joined: 29-April 10

Posted 11 May 2010 - 03:25 PM

View Postmdomba, on 11 May 2010 - 02:06 AM, said:

Take a look at the Yii blog tutorial - http://www.yiiframew.../start.overview

Yii blog tutorial, authenticating user - http://www.yiiframew.../prototype.auth


Thanks so much for the reply, but I saw that, and working from that is what caused my trouble.

From that link: "Note that this blog system does not provide the user management feature. As a result, a user cannot change his account or create a new one through the Web interface. The user management feature may be considered as a future enhancement to the blog application."

The blog tutorial leaves making a user management module up to the programmer and that is the part I cannot figure out.
0

#4 User is offline   Y!! 

  • Advanced Member
  • Yii
  • Group: Yii Dev Team
  • Posts: 978
  • Joined: 18-June 09

Posted 11 May 2010 - 03:54 PM

Yes you should use YourModel::beforeSave().

Some threads with code example: #1, #2, #3
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