You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ramonmaruko edited this page May 30, 2011
·
2 revisions
The following instructions apply for Clearance >= 0.11.0.
In your model:
class User < ActiveRecord::Base
include Clearance::User
def email_optional?
true
end
def self.authenticate(username, password)
return nil unless user = find_by_username(username)
return user if user.authenticated?(password)
end
end
In app/controllers/application_controller.rb:
class ApplicationController < ActionController::Base
include Clearance::Authentication
def authenticate(params)
User.authenticate(params[:session][:username],
params[:session][:password])
end
end