Skip to content

Commit 0cad5ac

Browse files
committed
Fix auth
1 parent 09ccbfe commit 0cad5ac

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

services/app/apps/codebattle/lib/codebattle_web/controllers/auth_controller.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,22 @@ defmodule CodebattleWeb.AuthController do
1313
url = Application.get_env(:codebattle, :force_redirect_url, "/")
1414

1515
url =
16-
if url == "" do
16+
if url in [nil, ""] do
1717
"/"
1818
else
1919
url
2020
end
2121

22+
Logger.info("Redirecting to #{url}")
23+
2224
conn
2325
|> put_flash(:info, gettext("Successfully authenticated"))
2426
|> put_session(:user_id, user.id)
2527
|> redirect(to: url)
2628

2729
{:error, reason} ->
30+
Logger.error("Failed to authenticate user: #{inspect(reason)}")
31+
2832
if url = Application.get_env(:codebattle, :guest_user_force_redirect_url) do
2933
conn
3034
|> redirect(external: url)

services/app/apps/codebattle/lib/codebattle_web/controllers/session_controller.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ defmodule CodebattleWeb.SessionController do
88
Application.get_env(:codebattle, :use_only_token_auth) ->
99
render(conn, "token_only.html")
1010

11-
Application.get_env(:codebattle, :use_local_password_auth) || true ->
11+
Application.get_env(:codebattle, :use_local_password_auth) ->
1212
render(conn, "local_password.html")
1313

1414
:default ->

0 commit comments

Comments
 (0)