diff --git a/lib/accounts/user_live/registration.ex b/lib/accounts/user_live/registration.ex index a441345a..b3bb28fa 100644 --- a/lib/accounts/user_live/registration.ex +++ b/lib/accounts/user_live/registration.ex @@ -26,8 +26,7 @@ defmodule UneebeeWeb.Live.Registration do def handle_event("save", %{"user" => user_params}, socket) do case Accounts.register_user(user_params) do {:ok, user} -> - {:ok, _} = - confirm_account(user, socket.assigns.host_school) + confirm_account(user, socket.assigns.host_school) maybe_create_school_user(user, socket.assigns.school) diff --git a/test/accounts/user_live/user_registration_live_test.exs b/test/accounts/user_live/user_registration_live_test.exs index 4b9fbbe8..cc7479b3 100644 --- a/test/accounts/user_live/user_registration_live_test.exs +++ b/test/accounts/user_live/user_registration_live_test.exs @@ -39,6 +39,27 @@ defmodule UneebeeWeb.UserRegistrationLiveTest do end end + describe "register user (without email confirmation)" do + setup do + set_school(%{conn: build_conn()}, %{require_confirmation?: false}) + end + + test "creates account and logs the user in", %{conn: conn} do + {:ok, lv, _html} = live(conn, ~p"/users/register") + + attrs = valid_user_attributes() + form = form(lv, "#registration_form", user: attrs) + render_submit(form) + conn = follow_trigger_action(form, conn) + + assert redirected_to(conn) == ~p"/" + + # Now do a logged in request + response = html_response(get(conn, ~p"/courses"), 200) + assert response =~ "Settings" + end + end + describe "register user (school configured)" do setup do set_school(%{conn: build_conn()}, %{require_confirmation?: true})