Login por matricula
This commit is contained in:
@ -19,9 +19,9 @@ defmodule DerivantesWeb.UserSessionController do
|
||||
end
|
||||
|
||||
defp create(conn, %{"user" => user_params}, info) do
|
||||
%{"email" => email, "password" => password} = user_params
|
||||
%{"matricula" => matricula, "password" => password} = user_params
|
||||
|
||||
if user = Accounts.get_user_by_email_and_password(email, password) do
|
||||
if user = Accounts.get_user_by_matricula_and_password(matricula, password) do
|
||||
conn
|
||||
|> put_flash(:info, info)
|
||||
|> UserAuth.log_in_user(user, user_params)
|
||||
@ -29,7 +29,7 @@ defmodule DerivantesWeb.UserSessionController do
|
||||
# In order to prevent user enumeration attacks, don't disclose whether the email is registered.
|
||||
conn
|
||||
|> put_flash(:error, "Invalid email or password")
|
||||
|> put_flash(:email, String.slice(email, 0, 160))
|
||||
|> put_flash(:matricula, String.slice(matricula, 0, 160))
|
||||
|> redirect(to: ~p"/derivantes/log_in")
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user