Sha256: 9f6a0c7c4f73c86e88d431e87bfed0d093a2b86d3334a0998e80048df7d911eb

Contents?: true

Size: 1.17 KB

Versions: 7

Compression:

Stored size: 1.17 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 {|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

7 entries across 7 versions & 1 rubygems

Version Path
authpds-0.0.19 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.18 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.17 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.16 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.15 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.14 lib/authpds/controllers/authpds_user_sessions_controller.rb
authpds-0.0.13 lib/authpds/controllers/authpds_user_sessions_controller.rb