Commit 53a345b6bc10d528ccd5b48416a35ea5040acd71

Authored by Antonio Terceiro
1 parent 76d52555

Cosmetic changes in change password/forgot password features

app/models/change_password.rb
1 -# TODO: send an e-mail with a hash code to the task after the ChangePassword is creatd -> override messages from #Task  
2 -  
3 -# FIXME remove this workaround  
4 -class HumanName  
5 - def human_name  
6 - @name  
7 - end  
8 - def initialize(name)  
9 - @name = name  
10 - end  
11 -end  
12 -  
13 class ChangePassword < Task 1 class ChangePassword < Task
14 2
15 serialize :data, Hash 3 serialize :data, Hash
@@ -17,15 +5,22 @@ class ChangePassword &lt; Task @@ -17,15 +5,22 @@ class ChangePassword &lt; Task
17 self[:data] ||= {} 5 self[:data] ||= {}
18 end 6 end
19 7
20 - # FIXME ugly workaround  
21 - self.columns_hash['login'] = HumanName.new _('Username')  
22 - self.columns_hash['email'] = HumanName.new _('e-Mail')  
23 -  
24 attr_accessor :login, :email, :password, :password_confirmation 8 attr_accessor :login, :email, :password, :password_confirmation
25 - N_('ChangePassword|Login')  
26 - N_('ChangePassword|Email')  
27 - N_('ChangePassword|Password')  
28 - N_('ChangePassword|Password Confirmation') 9 +
  10 + def self.human_attribute_name(attrib)
  11 + case attrib.to_sym
  12 + when :login:
  13 + _('Username')
  14 + when :email
  15 + _('e-Mail')
  16 + when :password
  17 + _('Password')
  18 + when :password_confirmation
  19 + _('Password Confirmation')
  20 + else
  21 + _(self.superclass.human_attribute_name(attrib))
  22 + end
  23 + end
29 24
30 ################################################### 25 ###################################################
31 # validations for creating a ChangePassword task 26 # validations for creating a ChangePassword task
app/views/account/change_password.rhtml
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 <p><label for="password_confirmation"><%= _('Confirm your new Password') %></label><br/> 11 <p><label for="password_confirmation"><%= _('Confirm your new Password') %></label><br/>
12 <%= password_field_tag :new_password_confirmation %></p> 12 <%= password_field_tag :new_password_confirmation %></p>
13 13
14 -<%= submit_tag _('Change password') %> 14 +<%= submit_button :ok, _('Change password') %>
15 15
16 <% end %> 16 <% end %>
17 17
app/views/account/new_password.rhtml
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 <%= labelled_form_field(_('Enter new password'), (f.password_field :password)) %> 11 <%= labelled_form_field(_('Enter new password'), (f.password_field :password)) %>
12 <%= labelled_form_field(_('Confirm the new password'), (f.password_field :password_confirmation)) %> 12 <%= labelled_form_field(_('Confirm the new password'), (f.password_field :password_confirmation)) %>
13 <% button_bar do %> 13 <% button_bar do %>
14 - <%= submit_button('change_password', _('Change password')) %> 14 + <%= submit_button(:ok, _('Change password')) %>
15 <% end %> 15 <% end %>
16 16
17 <% end %> 17 <% end %>