Sha256: 6c18b7555f68cf6a0ff01605f9b02ee816ddeb2afa1e069c8d20b84bb24dc1b3

Contents?: true

Size: 509 Bytes

Versions: 6

Compression:

Stored size: 509 Bytes

Contents

class SessionsController < ApplicationController
	def new
		redirect_to root_path if current_user
	end

	def create
		ldap_user = Adauth.authenticate(params[:username], params[:password])
		if ldap_user
        	user = <%= model_name.camelize %>.return_and_create_with_adauth(ldap_user)
        	session[:user_id] = user.id
        	redirect_to root_path
    	else
        	redirect_to root_path, :error => "Invalid Login"
    	end
	end

	def destroy
		session[:user_id] = nil
		redirect_to root_path
	end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adauth-1.2.1 lib/generators/adauth/sessions/templates/sessions_controller.rb.erb
adauth-1.2.0 lib/generators/adauth/sessions/templates/sessions_controller.rb.erb
adauth-1.1.0 lib/generators/adauth/sessions/templates/sessions_controller.rb.erb
adauth-1.0.1 lib/generators/adauth/sessions/templates/sessions_controller.rb.erb
adauth-1.0.0 lib/generators/adauth/sessions/templates/sessions_controller.rb.erb
adauth-1.0.0pre lib/generators/adauth/sessions/templates/sessions_controller.rb.erb