add missing session-related links (philomena-dev/philomena#23)

This commit is contained in:
byte[] 2020-09-27 00:03:34 -04:00
parent 9fbff24bd7
commit f01a9cf20b
2 changed files with 16 additions and 6 deletions

View file

@ -20,9 +20,11 @@ defmodule PhilomenaWeb.SessionController do
cond do
not is_nil(user) and is_nil(user.confirmed_at) ->
conn
|> put_flash(:error, "You must confirm your account before logging in.")
|> redirect(to: "/")
render(
conn,
"new.html",
error_message: "You must confirm your account before logging in."
)
not is_nil(user) ->
conn
@ -30,7 +32,12 @@ defmodule PhilomenaWeb.SessionController do
|> UserAuth.log_in_user(user, user_params)
true ->
render(conn, "new.html", error_message: "Invalid email or password")
render(
conn,
"new.html",
error_message:
"Invalid email or password. If you're seeing this more than usual, your account may be locked."
)
end
end

View file

@ -4,6 +4,8 @@ h1 Sign in
= if @error_message do
.alert.alert-danger
p = @error_message
p = link "Resend unlock instructions", to: Routes.unlock_path(@conn, :new)
p = link "Resend confirmation email", to: Routes.confirmation_path(@conn, :new)
p = link "Forgot your password?", to: Routes.password_path(@conn, :new)
@ -16,10 +18,11 @@ h1 Sign in
= error_tag f, :password
.field
= checkbox f, :remember_me
=> checkbox f, :remember_me
= label f, :remember_me, "Remember me"
= submit "Sign in", class: "button"
.actions
= submit "Sign in", class: "button"
p
strong