sessions: raise exception on failed login attempts.

* Allow both xml and json authentication in sessions controller.

* Raise an exception if a login attempt fails so that a) we return a
  proper error for json/xml requests and b) failed login attempts get
  reported to NewRelic (for monitoring abuse).
This commit is contained in:
evazion
2019-10-07 22:27:38 -05:00
parent a5ab25d0ba
commit cc4e39b88b
2 changed files with 4 additions and 11 deletions

View File

@@ -51,7 +51,7 @@ class ApplicationController < ActionController::Base
when ActionController::BadRequest
render_error_page(400, exception)
when SessionLoader::AuthenticationFailure
render_error_page(401, exception)
render_error_page(401, exception, template: "sessions/new")
when ActionController::InvalidAuthenticityToken, ActionController::UnpermittedParameters, ActionController::InvalidCrossOriginRequest
render_error_page(403, exception)
when User::PrivilegeError