Skip to content

Instantly share code, notes, and snippets.

@mikeebert
Created July 13, 2012 02:05
Show Gist options
  • Select an option

  • Save mikeebert/3102275 to your computer and use it in GitHub Desktop.

Select an option

Save mikeebert/3102275 to your computer and use it in GitHub Desktop.
A Warden Strategy
Warden::Strategies.add(:password) do
def valid?
params["email"] || params["password"]
end
def authenticate!
user = Datastore.for(:user).find_by_email(params["email"])
if user && user.authenticate(params["password"])
success!(user)
else
fail!("Could not log in")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment