21491 Posts in 5783 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 264 Views |
-
How to save Member Password manually?

3 April 2012 at 4:26pm
Greets,
I am trying to make a registration form for Members, but cannot use $form->saveInto($member) due to custom functionality.
This does not work: http://pastie.org/3718370
It gives me a server error and defaults to the blackcandy template.
Can anyone advise?
Cheers,
Nova -
Re: How to save Member Password manually?

4 April 2012 at 5:13am
Hi,
I've done this in the past that should save you some lines of code too (assuming your form is setup correctly)...
$doMember = new Member($data);
$doMember->write();alternativly if you check the docs you could make the member and then set the password with a fucntion...
http://api.silverstripe.org/2.4/sapphire/security/Member.html#methodchangePassword
-
Re: How to save Member Password manually?

4 April 2012 at 10:45am
Thanks Swaiba, I couldn't do you first method as I was not able to make the Form Field Names match the Names of the Fields in the Database due to third party applications relying on certain Field Names. However, your changePassword suggestion helped me do the following:
function doRegister($data, $form) {
// Write the new member to the SilverStripe Database
$member = new Member();
$member->FirstName = $data['GivenName'];
$member->Surname = $data['FamilyName'];
$member->Email = $data['EMail']['Home'];
$password = $data['Password']['_Password'];
$member->changePassword($password);
$member->write();
return Director::redirect('please-verify-your-account/');
}Cheers,
Nova
| 264 Views | ||
|
Page:
1
|
Go to Top |


