Skip to content

Commit

Permalink
Redirect bc to home page (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
macifell authored Sep 23, 2024
1 parent 7dff888 commit 2b63c17
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/recognizer/bigcommerce.ex
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ defmodule Recognizer.BigCommerce do
user
|> Recognizer.Repo.preload(:bigcommerce_user)
|> jwt_claims()
|> Map.put("redirect_to", "/")
|> Token.generate_and_sign(jwt_signer())

token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ defmodule RecognizerWeb.Accounts.UserRegistrationControllerTest do
|> Jason.decode!(keys: :atoms)

assert redirect =~ "http://localhost/login/"
refute :redirect_to in Map.keys(jwt_payload)
assert %{redirect_to: "/"} = jwt_payload
end

test "redirects to bigcommerce checkout if already logged in", %{conn: conn} do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ defmodule RecognizerWeb.Accounts.UserSessionControllerTest do
|> Jason.decode!(keys: :atoms)

assert redirect =~ "http://localhost/login/"
refute :redirect_to in Map.keys(jwt_payload)
assert %{redirect_to: "/"} = jwt_payload
end

test "redirects to bigcommerce checkout if already logged in", %{conn: conn, user: user} do
Expand Down

0 comments on commit 2b63c17

Please sign in to comment.