From 84191f692eba34b52625d045e64336fa11367922 Mon Sep 17 00:00:00 2001 From: LucasC Date: Fri, 16 May 2025 17:41:54 +0200 Subject: [PATCH 1/2] XWIKI-20630: Improve usability of the "Change Password" page * Updated the error message so that it's easier to understand that it's asynchronous (contrarily to live validation which happens as the user fills the form up) * Updated the error message creation to use a standard velocimacro. * Removed an unecessary line of information. This info is now always shown to users and handled by the live validation script. --- .../src/main/resources/ApplicationResources.properties | 2 +- .../src/main/resources/templates/passwd.vm | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/ApplicationResources.properties b/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/ApplicationResources.properties index adec83f19c63..b9cf8c63c7d4 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/ApplicationResources.properties +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/ApplicationResources.properties @@ -677,7 +677,7 @@ platform.core.profile.passwd.reenterPassword=Reenter password platform.core.profile.passwd.submit=Save platform.core.profile.passwd.cancel=Cancel and return to profile platform.core.profile.passwd.passwordMissmatch=The two passwords do not match. -platform.core.profile.passwd.invalidOriginalPassword=Current password is invalid. +platform.core.profile.passwd.invalidOriginalPassword=Current password was invalid. platform.core.profile.passwd.passwordTooShort=Your new password should be at least 6 characters long. platform.core.profile.passwd.passwordCannotBeEmpty=The password cannot be empty. platform.core.profile.passwd.notAllowed=You are not allowed to perform this action. diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/passwd.vm b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/passwd.vm index 16bf66a2af31..1b3040a89b56 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/passwd.vm +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/passwd.vm @@ -70,7 +70,6 @@ #else #set ($passwordLength = $passwordOptions.passwordLength) #end - $services.localization.render('platform.core.profile.passwd.instructionsPasswordLength', $passwordLength) ## We won't ask for the original password if the user is admin and not updating his own profile. ## In all other cases, we ask for it. #if (!$hasAdmin || $isCurrentUsersProfile) @@ -106,7 +105,7 @@ #generateHtml($fields, $NULL) #if ($request.xwikipassword && !$isValidPassword) - $stringtool.join($errorMessage, "
")
+ #inlineError($stringtool.join($errorMessage, "
")) #end
From 57078c0b1cb39f3d6b03488c976565b9e4fba31c Mon Sep 17 00:00:00 2001 From: LucasC Date: Tue, 17 Jun 2025 14:05:31 +0200 Subject: [PATCH 2/2] XWIKI-20630: Improve usability of the "Change Password" page * Moved the async validation error before the form. * Reworded the error message to make it a bit clearer * Changed the async validation error from inline to standalone. Not discussed but looks better in this new context IMO. --- .../src/main/resources/ApplicationResources.properties | 2 +- .../src/main/resources/templates/passwd.vm | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/ApplicationResources.properties b/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/ApplicationResources.properties index b9cf8c63c7d4..a8416a49343d 100644 --- a/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/ApplicationResources.properties +++ b/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/ApplicationResources.properties @@ -677,7 +677,7 @@ platform.core.profile.passwd.reenterPassword=Reenter password platform.core.profile.passwd.submit=Save platform.core.profile.passwd.cancel=Cancel and return to profile platform.core.profile.passwd.passwordMissmatch=The two passwords do not match. -platform.core.profile.passwd.invalidOriginalPassword=Current password was invalid. +platform.core.profile.passwd.invalidOriginalPassword=The field "Current password" was incorrect. platform.core.profile.passwd.passwordTooShort=Your new password should be at least 6 characters long. platform.core.profile.passwd.passwordCannotBeEmpty=The password cannot be empty. platform.core.profile.passwd.notAllowed=You are not allowed to perform this action. diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/passwd.vm b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/passwd.vm index 1b3040a89b56..6ec5712dbdeb 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/passwd.vm +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-templates/src/main/resources/templates/passwd.vm @@ -101,12 +101,13 @@ ## This key fits better. #set ($fields[$index].label = $services.localization.render('xe.admin.passwordReset.step2.newPasswordVerification.label'))
+ ## Async validation feedback + #if ($request.xwikipassword && !$isValidPassword) + #error($stringtool.join($errorMessage, "
")) + #end ## CSRF prevention #generateHtml($fields, $NULL) - #if ($request.xwikipassword && !$isValidPassword) - #inlineError($stringtool.join($errorMessage, "
")) - #end