ZWeb.Plugs.LoginAuthentication (Portico/Z v0.1.0)
Handle login-based authentication system-wide.
See ZWeb.Oauth.GoogleController for details of how login currently works via Google.
Link to this section Summary
Functions
Ensure the given connection has a valid account in the session
Get the ZSchemas.Account of the logged-in user from a Conn or session.
Check if there's a ZSchemas.Account logged in.
Login (add a ZSchemas.Account to the session)
Logout (clear the session entirely)
Link to this section Functions
call(conn, action)
Ensure the given connection has a valid account in the session
Places the relevant ZSchemas.Account{} struct into conn.assigns under the key :login_account on success.
Redirects to login on failure.
fetch_account(conn_or_session)
Get the ZSchemas.Account of the logged-in user from a Conn or session.
Returns {:ok, account} on success and :error if the person is not logged in.
logged_in?(conn)
Check if there's a ZSchemas.Account logged in.
Returns the account if so, false if not.
login(conn, account)
Login (add a ZSchemas.Account to the session)
logout(conn)
Logout (clear the session entirely)