Module: Authpds::Controllers::AuthpdsSessionsController

Defined in:
lib/authpds/controllers/authpds_sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject

DELETE /user_sessions/1 GET /logout


21
22
23
24
25
26
# File 'lib/authpds/controllers/authpds_sessions_controller.rb', line 21

def destroy
	user_session = UserSession.find
	logout_url = user_session.logout_url(params)
	user_session.destroy unless user_session.nil?
	redirect_to user_session_redirect_url(logout_url)
end

#newObject

GET /user_sessions/new GET /login

Raises:

  • (RuntimeError)

7
8
9
10
11
# File 'lib/authpds/controllers/authpds_sessions_controller.rb', line 7

def new
	@user_session = UserSession.new(params)
	redirect_to @user_session.(params) unless @user_session..nil?
	raise RuntimeError.new( "Error in #{self.class}.\nNo login url defined") if @user_session..nil?
end

#validateObject

GET /validate


14
15
16
17
# File 'lib/authpds/controllers/authpds_sessions_controller.rb', line 14

def validate
	@user_session = UserSession.create(params[:user_session])
  redirect_to (params[:return_url].nil?) ? root_url : params[:return_url]
end