Module: Authpds::Controllers::AuthpdsUserSessionsController
- Defined in:
- lib/authpds/controllers/authpds_user_sessions_controller.rb
Instance Method Summary collapse
-
#destroy ⇒ Object
DELETE /user_sessions/1 GET /logout.
-
#new ⇒ Object
GET /user_sessions/new GET /login.
-
#validate ⇒ Object
GET /validate.
Instance Method Details
#destroy ⇒ Object
DELETE /user_sessions/1 GET /logout
28 29 30 31 32 33 |
# File 'lib/authpds/controllers/authpds_user_sessions_controller.rb', line 28 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 |
#new ⇒ Object
GET /user_sessions/new GET /login
7 8 9 10 11 12 |
# File 'lib/authpds/controllers/authpds_user_sessions_controller.rb', line 7 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 |
#validate ⇒ Object
GET /validate
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/authpds/controllers/authpds_user_sessions_controller.rb', line 15 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 |