Sha256: ede59f79bec6d653ddbe8bc4469d02f503772761b6964a180b45e17c047252ed
Contents?: true
Size: 934 Bytes
Versions: 13
Compression:
Stored size: 934 Bytes
Contents
# This controller handles the login/logout function of the site. class SessionsController < ApplicationController def new #Stub required for Lockdown to grant access end def create password_authentication(params[:login], params[:password]) end def destroy logger.info "resetting session in sessions controller" reset_session flash[:notice] = "You have been logged out." redirect_back_or_default('/') end protected def password_authentication(login, password) set_session_user(User.authenticate(login, password)) if logged_in? successful_login else failed_login end end def failed_login(message = 'Authentication failed.') flash[:error] = message redirect_back_or_default login_url end def successful_login flash[:notice] = "Logged in successfully" redirect_back_or_default Lockdown::System.fetch(:successful_login_path) end end
Version data entries
13 entries across 13 versions & 1 rubygems