Sha256: c5311e3f2e3c3af9be6b8838f483135598f5584657ccfb0a270ed6872c86f84c
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
require 'rails-auth/strategies/abstract_password' # This strategy uses a login and password parameter. # # Overwrite the :password_param, and :login_param # to return the name of the field (on the form) that you're using the # login with. These can be strings or symbols # # == Required # # === Methods # <User>.authenticate(login_param, password_param) # class Rails::Authentication module Strategies module Basic class Form < Base def run! if request.params[login_param] && request.params[password_param] user = user_class.authenticate(request.params[login_param], request.params[password_param]) if !user request.session.authentication.errors.clear! request.session.authentication.errors.add(login_param, strategy_error_message) end user end end # run! def strategy_error_message "#{login_param.to_s.capitalize} or #{password_param.to_s.capitalize} were incorrect" end end # Form end # Basic end # Strategies end # Authentication
Version data entries
3 entries across 3 versions & 1 rubygems