From fb65e36f5c575a67829d26b7b6d6690aedae749f Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Mon, 4 Mar 2019 22:48:23 +0200 Subject: [PATCH 1/2] [4.0][com_users] Add cancel action to profile form --- .../Controller/ProfileController.php | 19 +++++++++++++++++++ components/com_users/tmpl/profile/edit.php | 13 ++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/components/com_users/Controller/ProfileController.php b/components/com_users/Controller/ProfileController.php index 22a3069b395f6..2f8df81d6a40d 100644 --- a/components/com_users/Controller/ProfileController.php +++ b/components/com_users/Controller/ProfileController.php @@ -250,6 +250,25 @@ public function save() $app->setUserState('com_users.edit.profile.data', null); } + /** + * Method to cancel an edit. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function cancel() + { + // Check for request forgeries. + $this->checkToken(); + + // Flush the data from the session. + $this->app->setUserState('com_users.edit.profile', null); + + // Redirect to user profile. + $this->setRedirect(Route::_('index.php?option=com_users&view=profile', false)); + } + /** * Function that allows child controller access to model data after the data has been saved. * diff --git a/components/com_users/tmpl/profile/edit.php b/components/com_users/tmpl/profile/edit.php index 184634eb269d6..e3eb4d1686b24 100644 --- a/components/com_users/tmpl/profile/edit.php +++ b/components/com_users/tmpl/profile/edit.php @@ -33,7 +33,7 @@ -
+ form->getFieldsets() as $group => $fieldset) : ?> form->getFieldset($group); ?> @@ -124,14 +124,13 @@
- + - -
From 7c61dc8c90d35c3ce9346b6d4ecf432596a9073c Mon Sep 17 00:00:00 2001 From: SharkyKZ Date: Wed, 6 Mar 2019 08:54:44 +0200 Subject: [PATCH 2/2] Add formnovalidate to cancel button --- components/com_users/tmpl/profile/edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/com_users/tmpl/profile/edit.php b/components/com_users/tmpl/profile/edit.php index e3eb4d1686b24..3948e282811a9 100644 --- a/components/com_users/tmpl/profile/edit.php +++ b/components/com_users/tmpl/profile/edit.php @@ -127,7 +127,7 @@ -