[3.0] Print the registration errors that carry their own words - #9485
Open
albertlast wants to merge 1 commit into
Open
[3.0] Print the registration errors that carry their own words#9485albertlast wants to merge 1 commit into
albertlast wants to merge 1 commit into
Conversation
Refuse a registration for a weak password and the form says "The following errors were detected" above a bullet with nothing in it. Each error is [kind, text, log, args], where the kind is 'lang' for a language key and 'done' for a finished sentence - as the comment directly above the loop says. The loop ignores it and looks every one of them up in Errors. A 'done' error is not a key there, getTxt() returns an empty string for a key it cannot find, and that empty string is the bullet. It is the strength feedback from validatePassword() that reaches this, which is every rejection except 'short'. 2.1 read the kind here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Refuse a registration for a weak password and the form says "The following errors
were detected in your registration. Please correct them to continue:" above a
bullet with nothing in it.
Each entry in
$reg_errorsis[kind, text, log, args], where the kind is'lang'for a language key and'done'for a finished sentence. The commentdirectly above the loop says so:
The loop never reads
$error[0]. It looks every error up inErrors, a'done'error is not a key there,
getTxt()returns an empty string for a key it cannotfind, and that empty string is the bullet. 2.1 read the kind here.
What reaches it.
Register2builds['done', $password_error, false]whenever
validatePassword()hands back something that is not a language key —which is the zxcvbn feedback, so every strength rejection except
short. It isalso how
Security::validateUsername()reports a name already in use.What changes
One line: a
'done'error prints its own words.Testing
Registering with
password:with
abc, unchanged: "Your password must be at least 6 characters long."A clean registration still succeeds.
Issues References (Fixes|Related|Closes)
Related to #7933