Project

General

Profile

Feature #35450 » 35450-v2.patch

Go MAEDA, 2022-07-22 02:33

View differences:

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, :domain_not_allowed, :domain => address.rpartition('@').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
        domain_not_allowed: "contains the domain %{domain} which is not allowed"
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 contains the domain black.example which is not allowed'
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 contains the domain example.fr which is not allowed'
151 151
      end
152 152
    end
153 153
  end
(4-4/5)