Commit 88faac2bbbe3c493405080d58676bbf3f810c1f0
1 parent
f67fad45
Exists in
master
and in
28 other branches
Added prettier error messages on password recovery
(ActionItem2498)
Showing
2 changed files
with
5 additions
and
7 deletions
Show diff stats
app/models/change_password.rb
... | ... | @@ -7,7 +7,7 @@ class ChangePassword < Task |
7 | 7 | when :login: |
8 | 8 | _('Username') |
9 | 9 | when :email |
10 | - _('e-Mail') | |
10 | + _('e-mail') | |
11 | 11 | when :password |
12 | 12 | _('Password') |
13 | 13 | when :password_confirmation |
... | ... | @@ -20,9 +20,7 @@ class ChangePassword < Task |
20 | 20 | ################################################### |
21 | 21 | # validations for creating a ChangePassword task |
22 | 22 | |
23 | - validates_presence_of :login, :email, :environment_id, :on => :create | |
24 | - | |
25 | - validates_presence_of :requestor_id | |
23 | + validates_presence_of :login, :email, :environment_id, :on => :create, :message => _('must be filled in') | |
26 | 24 | |
27 | 25 | validates_format_of :email, :on => :create, :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda { |obj| !obj.email.blank? }) |
28 | 26 | |
... | ... | @@ -30,10 +28,10 @@ class ChangePassword < Task |
30 | 28 | unless data.login.blank? || data.email.blank? |
31 | 29 | user = User.find_by_login_and_environment_id(data.login, data.environment_id) |
32 | 30 | if user.nil? |
33 | - data.errors.add(:login, _('%{fn} is not a valid username.').fix_i18n) | |
31 | + data.errors.add(:login, _('is invalid or user does not exists.')) | |
34 | 32 | else |
35 | 33 | if user.email != data.email |
36 | - data.errors.add(:email) | |
34 | + data.errors.add(:email, _('does not match the username you filled in')) | |
37 | 35 | end |
38 | 36 | end |
39 | 37 | end | ... | ... |
app/views/account/forgot_password.rhtml
1 | 1 | <h1><%= _('Forgot your password?') %></h1> |
2 | 2 | |
3 | -<%= error_messages_for :change_password %> | |
3 | +<%= error_messages_for :change_password, :header_message => _('Instructions to password recovery could not be sent'), :message => nil %> | |
4 | 4 | |
5 | 5 | <% labelled_form_for :change_password, @change_password, :url => { :action => 'forgot_password' } do |f| %> |
6 | 6 | ... | ... |