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

Version Path
lockdown-0.3.10 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.1.3 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.1.4 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.2.0 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.1 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.11 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.12 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.13 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.14 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.4.0 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.2 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.15 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.3 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.4 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.5 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.6 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.7 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.8 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb
lockdown-0.3.9 rails_generators/lockdown_all/templates/app/controllers/sessions_controller.rb