FIX: Improve name validation in the signup form (#30150)

This commit is contained in:
Jan Cernik 2024-12-09 12:06:59 -03:00 committed by GitHub
parent f0ea57e30e
commit ca0ea3d201
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 0 deletions

View File

@ -30,6 +30,7 @@ export default Mixin.create({
"passwordRequired", "passwordRequired",
"rejectedPasswords.[]", "rejectedPasswords.[]",
"accountUsername", "accountUsername",
"accountName",
"accountEmail", "accountEmail",
"passwordMinLength", "passwordMinLength",
"forceValidationReason", "forceValidationReason",
@ -88,6 +89,17 @@ export default Mixin.create({
); );
} }
if (
!isEmpty(this.accountName) &&
this.accountPassword === this.accountName
) {
return EmberObject.create(
Object.assign(failedAttrs, {
reason: i18n("user.password.same_as_name"),
})
);
}
if ( if (
!isEmpty(this.accountEmail) && !isEmpty(this.accountEmail) &&
this.accountPassword === this.accountEmail this.accountPassword === this.accountEmail

View File

@ -2044,6 +2044,7 @@ en:
other: "Your password is too short (minimum is %{count} characters)." other: "Your password is too short (minimum is %{count} characters)."
common: "That password is too common." common: "That password is too common."
same_as_username: "Your password is the same as your username." same_as_username: "Your password is the same as your username."
same_as_name: "Your password is the same as your name."
same_as_email: "Your password is the same as your email." same_as_email: "Your password is the same as your email."
ok: "Your password looks good." ok: "Your password looks good."
instructions: instructions:

View File

@ -749,6 +749,8 @@ en:
user: user:
ip_address: "" ip_address: ""
password: "Password" password: "Password"
user_password:
password: "Password"
errors: errors:
<<: *errors <<: *errors
models: models: