mirror of
https://github.com/discourse/discourse.git
synced 2024-12-20 12:03:49 +08:00
FIX: Show validation error on confirmation user fields (#30232)
* FIX: Show validation error on confirmation user fields * test
This commit is contained in:
parent
c3e7d97048
commit
96417592a3
|
@ -19,4 +19,8 @@
|
|||
>*</span>{{/if}}{{/unless}}
|
||||
</span>
|
||||
</label>
|
||||
<InputTip
|
||||
@validation={{@validation}}
|
||||
class={{unless @validation.reason "hidden"}}
|
||||
/>
|
||||
</div>
|
|
@ -36,9 +36,13 @@ export default Mixin.create({
|
|||
userField.field.required &&
|
||||
(!userField.value || isEmpty(userField.value))
|
||||
) {
|
||||
const reasonKey =
|
||||
userField.field.field_type === "confirm"
|
||||
? "user_fields.required_checkbox"
|
||||
: "user_fields.required";
|
||||
validation = EmberObject.create({
|
||||
failed: true,
|
||||
reason: i18n("user_fields.required", {
|
||||
reason: i18n(reasonKey, {
|
||||
name: userField.field.name,
|
||||
}),
|
||||
element: userField.field.element,
|
||||
|
|
|
@ -104,6 +104,10 @@ acceptance("Create Account - User Fields", function (needs) {
|
|||
.dom(".user-field-what-is-your-pets-name .tip.bad")
|
||||
.exists("shows required field error");
|
||||
|
||||
assert
|
||||
.dom(".user-field-ive-read-the-terms-of-service .tip.bad")
|
||||
.exists("shows required field error");
|
||||
|
||||
assert
|
||||
.dom(".user-field-whats-your-dad-like .tip.bad")
|
||||
.exists("shows same as password error");
|
||||
|
|
|
@ -1212,7 +1212,8 @@ en:
|
|||
user_fields:
|
||||
none: "(select an option)"
|
||||
required: 'Please enter a value for "%{name}"'
|
||||
same_as_password: "Your password should not be repeated in other fields."
|
||||
required_checkbox: 'The field "%{name}" is required'
|
||||
same_as_password: "Your password should not be repeated in other fields"
|
||||
optional: (optional)
|
||||
|
||||
user:
|
||||
|
|
Loading…
Reference in New Issue
Block a user