Created
February 16, 2021 20:38
-
-
Save carlyleec/e18ef961331fe4e8689eeef5d3ff06c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
def new(conn, _params) do | |
render(conn, "new.html", error_message: nil) | |
end | |
def create(conn, %{"user" => user_params}) do | |
%{"email" => email, "password" => password} = user_params | |
if user = Accounts.get_user_by_email_and_password(email, password) do | |
UserAuth.log_in_user(conn, user, user_params) | |
else | |
render(conn, "new.html", error_message: "Invalid email or password") | |
end | |
end | |
def delete(conn, _params) do | |
conn | |
|> put_flash(:info, "Logged out successfully.") | |
|> UserAuth.log_out_user() | |
end | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment