Sha256: 3c363d97645b13e4306ac29cf0fe1d4e5b57bea0d15d24ef22a5a35023a94787

Contents?: true

Size: 1.18 KB

Versions: 12

Compression:

Stored size: 1.18 KB

Contents

module Authpds
  module Controllers
    module AuthpdsUserSessionsController

    	# GET /user_sessions/new
    	# GET /login
    	def new
    		@user_session = UserSession.new(params)
    		@user_session.before_login(params) and return if performed?
    		redirect_to @user_session.login_url(params) unless @user_session.login_url.nil?
    		raise RuntimeError.new( "Error in #{self.class}.\nNo login url defined") if @user_session.login_url.nil?
    	end

    	# GET /validate
    	def validate
    		@user_session = UserSession.new(params[:user_session])
    		@user_session.save do |result|
    			@user_session.errors.each_full {|error|
    				flash[:error] = "There was an error logging in. #{error}"
    				logger.error("Error in #{self.class} while saving user session. #{error}")
    			} unless result
    	    	redirect_to (params[:return_url].nil?) ? root_url : params[:return_url]
    		end
    	end

    	# DELETE /user_sessions/1
    	# GET /logout
    	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
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
authpds-0.0.12 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.11 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.10 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.9 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.8 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.7 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.6 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.5 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.4 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.3 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.2 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.1 lib/authpds/controllers/authpds_user_sessions_controller.rb