omniauth-internal is a OmniAuth
strategy to authenticate using Rails 3.1 has_secure_password
by delegating to User.authenticate(username, password).
omniauth-internal can be used as an authenticator for OmniAuth MultiPassword.
Add this line to your application's Gemfile:
gem 'omniauth-internal'
And then execute:
$ bundle
Or install it yourself as:
$ gem install omniauth-internal
Add a authenticate class method to your model:
def self.authenticate(login, password)
find_by_email(login).try(:authenticate, password)
endYou can configure the model class used by omniauth-internal.
Rails.application.config.middleware.use OmniAuth::Builder do
provider :internal, :model => ::MyUser
end** model **
The model to call authenticate on.
(default: User)
** title **
The title text shown on default login form.
(default: "Restricted Access")
** fields **
The request parameter names to fetch username and password.
(default: [ "username", "password" ])
Copyright (c) 2012, Jan Graichen