Feature #35450 » fixed-error-message.patch
app/models/email_address.rb | ||
---|---|---|
143 | 143 |
end |
144 | 144 | |
145 | 145 |
def validate_email_domain |
146 |
errors.add(:address, :invalid) unless self.class.valid_domain?(address)
|
|
146 |
errors.add(:address, :not_allow_domain, :domain => address.split('@').last) unless self.class.valid_domain?(address)
|
|
147 | 147 |
end |
148 | 148 |
end |
config/locales/en.yml | ||
---|---|---|
136 | 136 |
must_contain_lowercase: "must contain lowercase letters (a-z)" |
137 | 137 |
must_contain_digits: "must contain digits (0-9)" |
138 | 138 |
must_contain_special_chars: "must contain special characters (!, $, %, ...)" |
139 |
not_allow_domain: "does not allow domain %{domain}" |
|
139 | 140 | |
140 | 141 |
actionview_instancetag_blank_option: Please select |
141 | 142 |
test/functional/email_addresses_controller_test.rb | ||
---|---|---|
131 | 131 |
} |
132 | 132 |
) |
133 | 133 |
assert_response :success |
134 |
assert_select_error 'Email is invalid'
|
|
134 |
assert_select_error 'Email does not allow domain black.example'
|
|
135 | 135 |
end |
136 | 136 |
end |
137 | 137 | |
... | ... | |
147 | 147 |
} |
148 | 148 |
) |
149 | 149 |
assert_response :success |
150 |
assert_select_error 'Email is invalid'
|
|
150 |
assert_select_error 'Email does not allow domain example.fr'
|
|
151 | 151 |
end |
152 | 152 |
end |
153 | 153 |
end |