This commit is contained in:
Georg G 2015-04-22 00:33:55 +02:00
parent 20101e4213
commit ef4fd30cd9
3 changed files with 3 additions and 3 deletions

View File

@ -68,7 +68,7 @@ class User < ActiveRecord::Base
end
def self.find_first_by_auth_conditions(warden_conditions)
conditions = warden_conditions.dup.to_h
conditions = warden_conditions.dup
if login = conditions.delete(:login)
where(conditions).where(["lower(screen_name) = :value OR lower(email) = :value", { :value => login.downcase }]).first
else

View File

@ -3,7 +3,7 @@
= bootstrap_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
= devise_error_messages!
= f.text_field :screen_name, autofocus: true, label: "User name"
= f.text_field :login, autofocus: true, label: "User name"
= f.submit "Send me password reset instructions"
= render "devise/shared/links"

View File

@ -181,7 +181,7 @@ Devise.setup do |config|
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
config.reset_password_keys = [ :screen_name ]
config.reset_password_keys = [ :login ]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to