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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Custom Login Forgot Password Page Template


Go to End


4 Posts   5763 Views

Avatar
ckd

Community Member, 18 Posts

24 August 2009 at 3:22pm

Hi,

I have created a Custom Login page using Security_login.ss. How do I do the same for the 'I've lost my password' page. For example, when you click on the 'I've lost my password' link, it takes you to another page that uses the sites Page.ss when in fact I want it to use a custom page similar to the custom login page I have already created? I did try using the ForgotPasswordEmail.ss but that seems to be used just for customizing the content that is sent to the email address and not for creating a custom forgot password email page.

Any help would be greatly appreciated.

Avatar
dalesaurus

Community Member, 283 Posts

25 August 2009 at 5:38am

Edited: 26/08/2009 2:31am

EDIT: I seriously overcomplicated the matter here, see next post for the best answer.

The lost password section doesn't use a .ss template file. A 'virtual' page is created and rendered when you go to yoursite.com/Security/lostpassword. You have 2 options that I can think of:

1. Go in and change the page under /sapphire/security/Security.php starting at line 376
This is the easiest and will get it done for you but it is NEVER a good idea to modify a framework's code. Your site will break if you upgrade.

2. Extend the Security object and override the lostpassword() function to use your own code that renders with a template. You would then have to switch out the existing Security object in one of your _config.php files:

Object::useCustomClass('Security','MyNewSecurity');

This is the "right" way to do it but does require some custom coding.

Avatar
Martijn

Community Member, 271 Posts

25 August 2009 at 9:48am

Try Security_lostpassword.ss

Avatar
ckd

Community Member, 18 Posts

26 August 2009 at 12:07am

@dalesaurus Thank you. Yes, agree, I wanted to avoid modifying the framework itself. Using Security_lostpassword.ss works as suggested by Martijn.

@martijn Thanks. This works perfectly!