Feature #35450 » 35450-v2.patch
| app/models/email_address.rb | ||
|---|---|---|
|
end
|
||
|
def validate_email_domain
|
||
|
errors.add(:address, :invalid) unless self.class.valid_domain?(address)
|
||
|
errors.add(:address, :domain_not_allowed, :domain => address.rpartition('@').last) unless self.class.valid_domain?(address)
|
||
|
end
|
||
|
end
|
||
| config/locales/en.yml | ||
|---|---|---|
|
must_contain_lowercase: "must contain lowercase letters (a-z)"
|
||
|
must_contain_digits: "must contain digits (0-9)"
|
||
|
must_contain_special_chars: "must contain special characters (!, $, %, ...)"
|
||
|
domain_not_allowed: "contains the domain %{domain} which is not allowed"
|
||
|
actionview_instancetag_blank_option: Please select
|
||
| test/functional/email_addresses_controller_test.rb | ||
|---|---|---|
|
}
|
||
|
)
|
||
|
assert_response :success
|
||
|
assert_select_error 'Email is invalid'
|
||
|
assert_select_error 'Email contains the domain black.example which is not allowed'
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
}
|
||
|
)
|
||
|
assert_response :success
|
||
|
assert_select_error 'Email is invalid'
|
||
|
assert_select_error 'Email contains the domain example.fr which is not allowed'
|
||
|
end
|
||
|
end
|
||
|
end
|
||