You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to I have proceed for logout a user in a Redirects.ex?
I am checking if a user has permission to log in on a specific day, but when he's not allowed I am not able to log out the session. When the function session_create is called I need to log out the user before redirects.
I tried to use Coherence.SessionController.delete/2 but does not work, tried import, use, alias and nothing worked.
Tried to call redirect(conn, to: session_path(conn, :delete)), but the it seems to call a GET verb instead DELETE and therefore, do not work too.
So I am stuck, helpless. Can anybody help?
The text was updated successfully, but these errors were encountered:
I would create a new plug and added it to the router pipeline before the coherence plug.
There, you can check if the user is logged in and should be prevented. If user is not logged in or if date constraint is satisfied, then just return conn, and the flow will continue normally.
Otherwise, call Coherence.ControllerHelpers.logout_user/1, redirect and halt. The halt will prevent the call of any following plugs.
How to I have proceed for logout a user in a Redirects.ex?
I am checking if a user has permission to log in on a specific day, but when he's not allowed I am not able to log out the session. When the function
session_create
is called I need to log out the user before redirects.I tried to use
Coherence.SessionController.delete/2
but does not work, tried import, use, alias and nothing worked.Tried to call
redirect(conn, to: session_path(conn, :delete))
, but the it seems to call aGET
verb insteadDELETE
and therefore, do not work too.So I am stuck, helpless. Can anybody help?
The text was updated successfully, but these errors were encountered: