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.

Customising the CMS /

Forgot Password


Reply


2 Posts   177 Views

Avatar
Dobby

Community Member, 1 Post

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, 45 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

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