File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
priv/templates/phx.gen.auth Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ defmodule <%= inspect auth_module %> do
110110 end
111111 end
112112
113- @doc """
113+ < % = if live? do % > @doc """
114114 Handles mounting and authenticating the current_<%= schema.singular %> in LiveViews.
115115
116116 ## `on_mount` arguments
@@ -182,7 +182,7 @@ defmodule <%= inspect auth_module %> do
182182 end )
183183 end
184184
185- @ doc """
185+ < % end % > @ doc """
186186 Used for routes that require the <%= schema.singular %> to not be authenticated.
187187 """
188188 def redirect_if_<% = schema. singular % > _is_authenticated ( conn , _opts ) do
Original file line number Diff line number Diff line change 11defmodule <% = inspect auth_module % > Test do
22 use <% = inspect context . web_module % > . ConnCase <% = test_case_options % >
33
4- alias Phoenix.LiveView
5- alias <% = inspect context . module % >
4+ < % = if live? do % > alias Phoenix.LiveView
5+ < % end % > alias <% = inspect context . module % >
66 alias <% = inspect context . web_module % > . < % = inspect Module . concat ( schema . web_namespace , schema . alias ) % > Auth
77 import <% = inspect context . module % > Fixtures
88
@@ -117,7 +117,7 @@ defmodule <%= inspect auth_module %>Test do
117117 end
118118 end
119119
120- describe " on_mount :mount_current_ <% = schema . singular % > " do
120+ <%= if live? do %> describe " on_mount :mount_current_ <% = schema . singular % > " do
121121 test "assigns current_<%= schema.singular %> based on a valid <%= schema.singular %>_token" , % { conn: conn , <% = schema . singular % > : <% = schema . singular % > } do
122122 < % = schema. singular % > _token = < % = inspect context . alias % > . generate_ <% = schema . singular % > _session_token ( < % = schema . singular % > )
123123 session = conn |> put_session ( :< % = schema . singular % > _token, < % = schema. singular % > _token) |> get_session ( )
@@ -212,7 +212,7 @@ defmodule <%= inspect auth_module %>Test do
212212 end
213213 end
214214
215- describe "redirect_if_<%= schema.singular %>_is_authenticated/2" do
215+ < % end % > describe "redirect_if_<%= schema.singular %>_is_authenticated/2" do
216216 test "redirects if <%= schema.singular %> is authenticated" , % { conn: conn , <% = schema . singular % > : <% = schema . singular % > } do
217217 conn = conn |> assign ( :current_ <% = schema . singular % > , < % = schema . singular % > ) |> <% = inspect schema . alias % > Auth . redirect_if_ <% = schema . singular % > _is_authenticated ( [ ] )
218218 assert conn. halted
You can’t perform that action at this time.
0 commit comments