For example if you want to enable user to login with either email or username, you just need to add the following things to your code:
class UserSession < Authlogic::Session::Base
find_by_login_method :find_by_username_or_email
end
and in user.rb
def self.find_by_username_or_email(login)
User.find_by_username(login) || User.find_by_email(login)
end
No comments:
Post a Comment