File tree 2 files changed +6
-6
lines changed
priv/templates/phx.gen.auth
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
110
110
end
111
111
end
112
112
113
- @doc """
113
+ < % = if live? do % > @doc """
114
114
Handles mounting and authenticating the current_<%= schema.singular %> in LiveViews.
115
115
116
116
## `on_mount` arguments
@@ -182,7 +182,7 @@ defmodule <%= inspect auth_module %> do
182
182
end )
183
183
end
184
184
185
- @ doc """
185
+ < % end % > @ doc """
186
186
Used for routes that require the <%= schema.singular %> to not be authenticated.
187
187
"""
188
188
def redirect_if_<% = schema. singular % > _is_authenticated ( conn , _opts ) do
Original file line number Diff line number Diff line change 1
1
defmodule <% = inspect auth_module % > Test do
2
2
use <% = inspect context . web_module % > . ConnCase <% = test_case_options % >
3
3
4
- alias Phoenix.LiveView
5
- alias <% = inspect context . module % >
4
+ < % = if live? do % > alias Phoenix.LiveView
5
+ < % end % > alias <% = inspect context . module % >
6
6
alias <% = inspect context . web_module % > . < % = inspect Module . concat ( schema . web_namespace , schema . alias ) % > Auth
7
7
import <% = inspect context . module % > Fixtures
8
8
@@ -117,7 +117,7 @@ defmodule <%= inspect auth_module %>Test do
117
117
end
118
118
end
119
119
120
- describe " on_mount :mount_current_ <% = schema . singular % > " do
120
+ <%= if live? do %> describe " on_mount :mount_current_ <% = schema . singular % > " do
121
121
test "assigns current_<%= schema.singular %> based on a valid <%= schema.singular %>_token" , % { conn: conn , <% = schema . singular % > : <% = schema . singular % > } do
122
122
< % = schema. singular % > _token = < % = inspect context . alias % > . generate_ <% = schema . singular % > _session_token ( < % = schema . singular % > )
123
123
session = conn |> put_session ( :< % = schema . singular % > _token, < % = schema. singular % > _token) |> get_session ( )
@@ -212,7 +212,7 @@ defmodule <%= inspect auth_module %>Test do
212
212
end
213
213
end
214
214
215
- describe "redirect_if_<%= schema.singular %>_is_authenticated/2" do
215
+ < % end % > describe "redirect_if_<%= schema.singular %>_is_authenticated/2" do
216
216
test "redirects if <%= schema.singular %> is authenticated" , % { conn: conn , <% = schema . singular % > : <% = schema . singular % > } do
217
217
conn = conn |> assign ( :current_ <% = schema . singular % > , < % = schema . singular % > ) |> <% = inspect schema . alias % > Auth . redirect_if_ <% = schema . singular % > _is_authenticated ( [ ] )
218
218
assert conn. halted
You can’t perform that action at this time.
0 commit comments