Login with password now requires email to be confirmed

This commit is contained in:
2026-04-06 13:18:00 -04:00
parent cc6586587f
commit 6927f6eb9b
4 changed files with 20 additions and 16 deletions

View File

@@ -37,6 +37,7 @@ defmodule Mixer.Accounts.User do
password :password do password :password do
identity_field :email identity_field :email
hash_provider AshAuthentication.BcryptProvider hash_provider AshAuthentication.BcryptProvider
require_confirmed_with :confirmed_at
resettable do resettable do
sender Mixer.Accounts.User.Senders.SendPasswordResetEmail sender Mixer.Accounts.User.Senders.SendPasswordResetEmail

View File

@@ -5,10 +5,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} /> <meta name="csrf-token" content={get_csrf_token()} />
<link rel="icon" href={~p"/favicon.ico"} sizes="any" /> <link rel="icon" href={~p"/favicon.ico"} sizes="any" />
<% <% meta_title = assigns[:page_title] || "Mixer"
meta_title = (assigns[:page_title] || "Mixer")
meta_description = assigns[:page_description] || "Mixer is a social feed for all. Come join the conversation — built with Elixir." meta_description =
%> assigns[:page_description] ||
"Mixer is a social feed for all. Come join the conversation — built with Elixir." %>
<meta name="description" content={meta_description} /> <meta name="description" content={meta_description} />
<meta name="robots" content={assigns[:robots] || "index, follow"} /> <meta name="robots" content={assigns[:robots] || "index, follow"} />
<meta property="og:site_name" content="Mixer" /> <meta property="og:site_name" content="Mixer" />

View File

@@ -9,8 +9,8 @@ SPDX-License-Identifier: MIT
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="csrf-token" content={get_csrf_token()} /> <meta name="csrf-token" content={get_csrf_token()} />
<link rel="icon" href={~p"/favicon.ico"} sizes="any" /> <link rel="icon" href={~p"/favicon.ico"} sizes="any" />
<% <% {spa_title, spa_description} =
{spa_title, spa_description} = case @page do case @page do
"feed" -> {"Mixer · Feed", "See the latest posts from everyone on Mixer."} "feed" -> {"Mixer · Feed", "See the latest posts from everyone on Mixer."}
"tweet" -> {"Mixer · Post", "Read this post and join the conversation on Mixer."} "tweet" -> {"Mixer · Post", "Read this post and join the conversation on Mixer."}
"following" -> {"Mixer · Following", "Posts from the people you follow on Mixer."} "following" -> {"Mixer · Following", "Posts from the people you follow on Mixer."}
@@ -18,8 +18,7 @@ SPDX-License-Identifier: MIT
"users" -> {"Mixer · People", "Discover and follow people on Mixer."} "users" -> {"Mixer · People", "Discover and follow people on Mixer."}
"user-detail" -> {"Mixer · Profile", "View this user's profile and posts on Mixer."} "user-detail" -> {"Mixer · Profile", "View this user's profile and posts on Mixer."}
_ -> {"Mixer", "A social feed built in Elixir."} _ -> {"Mixer", "A social feed built in Elixir."}
end end %>
%>
<meta name="description" content={spa_description} /> <meta name="description" content={spa_description} />
<meta name="robots" content="index, follow" /> <meta name="robots" content="index, follow" />
<meta property="og:site_name" content="Mixer" /> <meta property="og:site_name" content="Mixer" />

View File

@@ -35,8 +35,11 @@ defmodule MixerWeb.AuthController do
You can confirm your account using the link we sent to you, or by resetting your password. You can confirm your account using the link we sent to you, or by resetting your password.
""" """
{_, %AshAuthentication.Errors.UnconfirmedUser{}} ->
"You must confirm your email address before signing in. Please check your inbox for a confirmation email."
_ -> _ ->
"Incorrect email or password" "Incorrect email or password or unconfirmed email"
end end
conn conn