Sha256: 0347e41f6ef60307dd7ccd9966904838b8766890cd2e961bae833b0cbe9783ad
Contents?: true
Size: 886 Bytes
Versions: 19
Compression:
Stored size: 886 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 "/" end end
Version data entries
19 entries across 19 versions & 1 rubygems