Commit 5034abbbf3048fe63b8d343b58dd10998b3f2865
1 parent
c6bf7b15
Exists in
master
and in
28 other branches
Adding email to login label
Showing
1 changed file
with
2 additions
and
2 deletions
Show diff stats
app/models/user.rb
@@ -15,7 +15,7 @@ class User < ActiveRecord::Base | @@ -15,7 +15,7 @@ class User < ActiveRecord::Base | ||
15 | # FIXME ugly workaround | 15 | # FIXME ugly workaround |
16 | def self.human_attribute_name(attrib) | 16 | def self.human_attribute_name(attrib) |
17 | case attrib.to_sym | 17 | case attrib.to_sym |
18 | - when :login: return _('Username') | 18 | + when :login: return [_('Username'), _('Email')].join(' / ') |
19 | when :email: return _('e-Mail') | 19 | when :email: return _('e-Mail') |
20 | else _(self.superclass.human_attribute_name(attrib)) | 20 | else _(self.superclass.human_attribute_name(attrib)) |
21 | end | 21 | end |
@@ -116,7 +116,7 @@ class User < ActiveRecord::Base | @@ -116,7 +116,7 @@ class User < ActiveRecord::Base | ||
116 | 116 | ||
117 | validates_inclusion_of :terms_accepted, :in => [ '1' ], :if => lambda { |u| ! u.terms_of_use.blank? }, :message => N_('%{fn} must be checked in order to signup.').fix_i18n | 117 | validates_inclusion_of :terms_accepted, :in => [ '1' ], :if => lambda { |u| ! u.terms_of_use.blank? }, :message => N_('%{fn} must be checked in order to signup.').fix_i18n |
118 | 118 | ||
119 | - # Authenticates a user by their login name and unencrypted password. Returns the user or nil. | 119 | + # Authenticates a user by their login name or email and unencrypted password. Returns the user or nil. |
120 | def self.authenticate(login, password, environment = nil) | 120 | def self.authenticate(login, password, environment = nil) |
121 | environment ||= Environment.default | 121 | environment ||= Environment.default |
122 | u = self.first :conditions => ['(login = ? OR email = ?) AND environment_id = ? AND activated_at IS NOT NULL', | 122 | u = self.first :conditions => ['(login = ? OR email = ?) AND environment_id = ? AND activated_at IS NOT NULL', |