Yii Framework Forum: UserIdentity and Password encryption - Yii Framework Forum

Jump to content

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

UserIdentity and Password encryption Rate Topic: -----

#1 User is offline   GSTAR 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,035
  • Joined: 30-October 09
  • Location:UK

Posted 17 February 2010 - 09:16 AM

How can I enable password encryption in the database for use with UserIdentity?
0

#2 User is offline   Onman 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 175
  • Joined: 26-December 09
  • Location:The Netherlands

Posted 17 February 2010 - 11:02 AM

View PostGSTAR, on 17 February 2010 - 09:16 AM, said:

How can I enable password encryption in the database for use with UserIdentity?

when the user enters a new password, before storing it encrypt it (like $password=md5($password);).
when logging in, again first encrypt the entered password and then compare it with the value in the database.
1

#3 User is offline   GSTAR 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,035
  • Joined: 30-October 09
  • Location:UK

Posted 17 February 2010 - 11:11 AM

hmmm is there no built-in functioniality in Yii/UserIdentity component that will automate this process?

I need to also add a salt to the password.

EDIT: RESOLVED
0

#4 User is offline   yiimann 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 102
  • Joined: 19-December 09

Posted 17 February 2010 - 03:13 PM

stronger hash function:

	static function passwordHash($pass)
	{
		return hash('sha256', Yii::app()->params['hashSalt'].$pass);
	}	


and add a 'hashSalt' param to your main.php config file
2

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