From 02335055660aaa590c39b8dec5a61191daf88844 Mon Sep 17 00:00:00 2001 From: Mark Guinn Date: Fri, 20 May 2016 17:00:38 -0700 Subject: [PATCH] Fix to change password form on account page --- code/account/AccountPage.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/code/account/AccountPage.php b/code/account/AccountPage.php index 0ead09914..25a27df47 100644 --- a/code/account/AccountPage.php +++ b/code/account/AccountPage.php @@ -225,7 +225,17 @@ public function EditAccountForm() public function ChangePasswordForm() { + /** @var ChangePasswordForm $form */ $form = ChangePasswordForm::create($this, "ChangePasswordForm"); + + // The default form tries to redirect to /account/login which doesn't exist + $backURL = $form->Fields()->fieldByName('BackURL'); + if (!$backURL) { + $backURL = new HiddenField('BackURL', 'BackURL'); + $form->Fields()->push($backURL); + } + $backURL->setValue($this->Link('editprofile')); + $this->extend('updateChangePasswordForm', $form); $this->data()->extend('updateChangePasswordForm', $form);