Skip to content

Commit

Permalink
Clear session before redirecting.
Browse files Browse the repository at this point in the history
This fixes an infinite redirect loop that would happen when a token expires.
  • Loading branch information
suprnova32 committed May 21, 2018
1 parent 6bb1757 commit a1a56e2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/alloy_ci/web/controllers/admin/user_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ defmodule AlloyCi.Web.Admin.UserController do

def auth_error(conn, {_, _}, _opts) do
conn
|> clear_session()
|> put_flash(:error, "Admin Authentication required")
|> redirect(to: admin_login_path(conn, :new))
end
Expand Down
1 change: 1 addition & 0 deletions lib/alloy_ci/web/controllers/auth_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ defmodule AlloyCi.Web.AuthController do

def auth_error(conn, {_, _}, _opts) do
conn
|> clear_session()
|> put_flash(:error, "Authentication required")
|> redirect(to: auth_path(conn, :login, :login))
end
Expand Down

0 comments on commit a1a56e2

Please sign in to comment.