Sha256: 9f2c4e8dc82728b41ac9fa643fb3f08f37995a0ec528b67ae93df736cac33600
Contents?: true
Size: 918 Bytes
Versions: 1
Compression:
Stored size: 918 Bytes
Contents
module Challah # Allows authentication by username and password. class PasswordTechnique # grab the params we want from this request def initialize(session) @username = session.username? ? session.username : nil @password = session.password? ? session.password : nil end # if we can successfully authenticate, return a User instance, otherwise nil def authenticate if username? and password? user = Challah.user_model.find_for_session(username) if user if user.active? if user.authenticate(@password) return user end end user.failed_authentication! user = nil end end nil end def password? !!@password end def persist? true end def username? !!@username end def username @username end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
challah-0.7.0.pre2 | lib/challah/techniques/password_technique.rb |