From f01a9cf20b7eb74c7fb67ebecff9a1513b559417 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Sun, 27 Sep 2020 00:03:34 -0400 Subject: [PATCH] add missing session-related links (philomena-dev/philomena#23) --- .../controllers/session_controller.ex | 15 +++++++++++---- .../templates/session/new.html.slime | 7 +++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/philomena_web/controllers/session_controller.ex b/lib/philomena_web/controllers/session_controller.ex index 01e995aa..ee15bc12 100644 --- a/lib/philomena_web/controllers/session_controller.ex +++ b/lib/philomena_web/controllers/session_controller.ex @@ -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 diff --git a/lib/philomena_web/templates/session/new.html.slime b/lib/philomena_web/templates/session/new.html.slime index 24a86c8f..4c418d78 100644 --- a/lib/philomena_web/templates/session/new.html.slime +++ b/lib/philomena_web/templates/session/new.html.slime @@ -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