Jump to:

23367 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » Custom Login Forgot Password Page Template

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

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

Page: 1
Go to End
Author Topic: 3723 Views
  • ckd
    Avatar
    Community Member
    18 Posts

    Custom Login Forgot Password Page Template Link to this post

    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.

  • dalesaurus
    Avatar
    Community Member
    283 Posts

    Re: Custom Login Forgot Password Page Template Link to this post

    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.

  • Martijn
    Avatar
    Community Member
    271 Posts

    Re: Custom Login Forgot Password Page Template Link to this post

    Try Security_lostpassword.ss

  • ckd
    Avatar
    Community Member
    18 Posts

    Re: Custom Login Forgot Password Page Template Link to this post

    @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!

    3723 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.