4571 Posts in 1382 Topics by 1376 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2537 Views |
-
Admin password encryption

14 September 2009 at 8:36am
How exactly is the admin password encrypted?
I've created a registration form that encrypts the password with sha1. When I create a password 'password' in the table, it comes out as 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8, and as the admin password is also 'password' I'd expect it to be the same, but it's not - it's fy17qyc55m0o8kc0oks00os8w0gk44w, but the PasswordEncryption field for admin says sha1 anyway.
Can someone tell me how to get the encryption in my form working the same way as the admin record?
-
Re: Admin password encryption

14 September 2009 at 9:02am
Passwords are hashed and salted so they are unique. If you just hashed passwords you could pretty easily start guessing passwords.
The only way to get them the same is if they use the same salt and like I said, thats a security flaw. You can however override the default behaviour by setting Security::set_password_encryption_algorithm('sha1', false); in your config - false turning off salting
-
Re: Admin password encryption

15 September 2009 at 9:26am Last edited: 15 September 2009 9:27am
How would I go about generating a new salt and applying it to a new password in order to make it unique?
Is that even what I have to do?
-
Re: Admin password encryption

15 September 2009 at 9:39am
You can hash and salt a given string by running it through Security::encrypt_password("password"); and that will return you an array - the password, the salt and the hash. I think however, if you are making a registration form and you are saving the data into the Password field of the Member object it will do the salting and hashing for you.
-
Re: Admin password encryption

3 October 2009 at 7:48pm
Is there a way I can change the way the Login form checks what is typed in the password field with the database? Like, a .php file in Security or something? So that it only changes the password to sha1 with no salt and just checks it that way?
Sure, there'll be a security issue there, but this is just for experimental purposes anyway
-
Re: Admin password encryption

6 November 2009 at 3:35pm
We've done some work on pluggable password hashing in trunk, see http://open.silverstripe.org/ticket/3004 and http://open.silverstripe.org/ticket/3004 and http://open.silverstripe.org/ticket/3665
-
Re: Admin password encryption

5 February 2013 at 4:11pm
Hi Willr. I don't know if this is appropriate to add my issue here. This is an old post but i seem to have an issue to auto-hashing & salting on front-end. I am currently using SS 3.0.3 and I have a custom sign-up form on the front-end and I am using ConfirmedPasswordField but it seems the saved password is different since all the users I sign-up using the front-end form cant login.
Does the auto hash / salt may be causing some issues?
Front-end Form
,new TextField('Email', 'Email *')
,new TextField('JobTitle', 'Job Title *')
, new ConfirmedPasswordField('Password', 'New Password')Form Action
if($member = DataObject::get_one("Member", "`Email` = '". Convert::raw2sql($data['Email']) . "'"))
{
$form->AddErrorMessage('Email', "Sorry, that email address already exists. Please choose another.", 'bad');Session::set("FormInfo.StaffManagementPage_StaffManagementPage.data", $data);
return $this->redirectBack();;
}$member = new Member();
$form->saveInto($member);
$member->write();if($userGroup = DataObject::get_one('Group', "Code = 'staff'"))
{
Group::addToGroupByName($member, 'staff');
}
| 2537 Views | ||
|
Page:
1
|
Go to Top |




