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 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.

Form Questions /

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

Security/changepassword Redirect?

Go to End

4 Posts   3938 Views

Enclave SSC

Community Member, 31 Posts

27 January 2010 at 12:13am

Hi Guys

Security/changepassword upon completion redirects to Security/login. This is quite redundant as the user would already be logged in. Is there any wat to change this page to Redirect home for example. I attempted BackURL in the form action without joy.

Any assistance would be appreciated.


Community Member, 134 Posts

30 June 2010 at 1:05am


You can make a custom class that extends ChangePasswordForm.php – and override the doChangePassword-function. Inside this function there is a line which redirects the user.



Community Member, 24 Posts

11 January 2011 at 2:47pm

Actually currently (2.4.3) you can extend ChangePasswordForm and then use Object::useCustomClass as joel suggests, but it will not be picked up.

The above method works fine for MemberLoginForm as when that is called in MemberAuthenticator it uses Object::create instead of new MemberLoginForm.

The work around is to fix Security line 589 which in my opinion should use Object::create not new ChangePasswordForm.

However since its A VERY BAD IDEA TO EDIT THE CORE, simple create a new class called CustomSecurity which extends Security and then add a rule in mysite/config.php

Director::addRules(11, array(
	'Security//$Action/$ID/$OtherID' => 'CustomSecurity',

The rule above overrides the rule in Sapphire/_config because the priority is 11 which outranks 10.


Community Member, 24 Posts

11 January 2011 at 2:53pm

class CustomSecurity extends Security {

	 * Factory method for the lost password form
	 * @return Form Returns the lost password form
	public function ChangePasswordForm() {
		return Object::create('ChangePasswordForm', $this, 'ChangePasswordForm');