Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Forgot Password


Go to End


2 Posts   1168 Views

Avatar
Dobby

Community Member, 15 Posts

14 August 2014 at 1:31am

We are working on a page with Silverstripe and changed the login. Users can now login with a username instead of the email address. To make this possible, we added "Member::set_unique_identifier_field('Username');" to the _config.php.

Now we want to change the way a user can reset their password if they forget it. We want to make it possible to use the username instead of the email-address to get an email with the link to reset their password.
To this end, we have tried several things in the /mysite/_config.php, but it doesn't seem to work.

1. Object::add_extension('Security', 'UsernameSecurity');
2. Object::useCustomClass('Security','UsernameSecurity');
3. Director::addRules(11, array(
'Security//$Action/$ID/$OtherID' => 'UsernameSecurity',
));
Does anyone have any suggestions to get this to work better? Thank you in advance for your help!

Avatar
Kirk

Community Member, 67 Posts

14 August 2014 at 11:26am

I think the useCustomClass approach would be the best and just override the methods lostpassword and LostPaswordForm to reset the password

http://api.silverstripe.org/3.1/class-Object.html#$useCustomClass