I’m using the Login extra and I’m currently working on setting up the forgot password part, which is handled by the ResetPassword
snippet:
[[!ResetPassword?
&loginResourceId=`6`
&forceChangePassword=`true`
&changePasswordTpl=`password.new.form`
&expiredTpl=`password.reset.expired`
&errTpl=`cstErrTpl`]]
// cstErrTpl chunk
[[+msg]]
This snippet is called after a reset link was generated and when clicked on, shows the change password form like intended (I stripped some irrelevant parts):
[[!+logcp.error_message:notempty=`
<div class="alert-danger">[[!+logcp.error_message]]</div>
`]]
<form class="form" action="[[~[[*id]]]]" method="post">
<input type="password" class="form-control" name="password_new:required" id="password_new" value="[[!+logcp.password_new]]" />
<span class="text-danger">[[!+logcp.error.password_new]]</span>
<input type="password" class="form-control" name="password_new_confirm:required" id="password_new_confirm" value="[[!+logcp.password_new_confirm]]" />
<span class="text-danger">[[!+logcp.error.password_new_confirm]]</span>
<button class="btn" name="logcp-submit" type="submit"> [[%login.change_password]] </button>
</form>
Now, when I trigger the submit while the form contains any errors (e. g. empty fields, not matching, pw too short, etc.) there is NO logcp.error_message
(the big alert above the form) showing and the error messages under the faulty fields will be just cstErrTpl
(the custom name of the &errTpl
chunk).
When I remove the &errTpl
property which makes it default to
<p class="error">[[+msg]]</p>
everything works fine, alert is showing as well as proper field validation error messages. All except that I would like the logcp.error_message
not to be wrapped in a p
tag.
Also I dug a little through the code and from my understanding the &errTpl
property defines only the logcp.error_message
(the alert) and has nothing to do with the field errors. But somehow this chunkname still ends up as the content of the field errors.
Is this a bug or am I missing something here?
MODX 2.8.5
PHP 8.2.4