Skip to content

Commit 487618b

Browse files
authored
check user field in scope (#6114)
1 parent 0e772c5 commit 487618b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

priv/templates/phx.gen.auth/auth.ex

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ defmodule <%= inspect auth_module %> do
160160
def on_mount(:ensure_authenticated, _params, session, socket) do
161161
socket = mount_current_scope(socket, session)
162162

163-
if socket.assigns.current_scope do
163+
if socket.assigns.current_scope && socket.assigns.current_scope.<%= schema.singular %> do
164164
{:cont, socket}
165165
else
166166
socket =
@@ -233,7 +233,7 @@ defmodule <%= inspect auth_module %> do
233233
they use the application at all, here would be a good place.
234234
"""
235235
def require_authenticated_<%= schema.singular %>(conn, _opts) do
236-
if conn.assigns.current_scope do
236+
if conn.assigns.current_scope && conn.assigns.current_scope.<%= schema.singular %> do
237237
conn
238238
else
239239
conn

0 commit comments

Comments
 (0)