feat(auth): inline, specific error states on login and signup (#1440)

* feat(auth): inline, specific error states on login and signup

Auth failures now render inline next to the form instead of as a
top-right toast: a persistent alert with role=alert, aria-invalid
field highlighting, and focus returned to the offending field.

Login maps GoTrue error codes (invalid_credentials, email_not_confirmed,
rate limits, user_banned) to specific Swedish/English messages, with a
reset-password link embedded in the credentials error. The credentials
message stays 'wrong email or password' by design: GoTrue returns one
code for both cases to prevent account enumeration.

Signup gets a live password-requirements checklist, field-level errors
for weak/mismatched passwords, and inline handling of email-exists,
invalid-email and rate-limit responses with a sign-in link where that
is the recovery path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(auth): treat email_provider_disabled as signup-disabled with specific copy

Review follow-up: GoTrue signals disabled email/password signups with
email_provider_disabled as well as signup_disabled; classify both (plus
the message-string fallback for older GoTrue) and give the register form
a specific inline message instead of the generic fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-08-06 21:24:36 +02:00
committed by GitHub
co-authored by Claude Fable 5 Jakob Wennberg
parent a0ca692fed
commit 0bb0b89353
9 changed files with 420 additions and 99 deletions
+14 -2
View File
@@ -269,7 +269,11 @@
"or_email_divider": "or sign in with email",
"login_failed_title": "Sign in failed",
"login_failed_bankid": "Could not complete BankID sign in.",
"login_invalid_credentials": "Wrong email or password.",
"login_invalid_credentials": "Wrong email address or password.",
"login_error_email_not_confirmed": "Your email address hasn't been confirmed yet. Click the link in the email you received when the account was created.",
"login_error_rate_limited": "Too many sign-in attempts. Wait a moment and try again.",
"login_error_user_banned": "This account has been suspended. Contact support if you think this is a mistake.",
"login_error_reset_link": "Reset your password",
"session_idle": "You were inactive. Sign in again.",
"session_absolute": "Your session expired for security reasons.",
"use_password_instead": "Sign in with email instead",
@@ -925,9 +929,17 @@
"bankid_email_hint": "Used for sign-in and notifications.",
"invite_email_hint": "The invitation was sent to this address.",
"password_label": "Password",
"password_placeholder": "Min 8 chars, Aa1!",
"password_placeholder": "Choose a strong password",
"confirm_password_label": "Confirm password",
"confirm_password_placeholder": "Repeat the password",
"password_req_length": "At least 8 characters",
"password_req_case": "Upper and lower case letters",
"password_req_number": "At least one number",
"password_req_special": "At least one special character",
"password_error_requirements": "The password doesn't meet all the requirements yet.",
"error_email_invalid": "That email address doesn't look valid. Check the spelling.",
"error_rate_limited": "Too many attempts. Wait a moment and try again.",
"error_signup_disabled": "Account registration is turned off on this installation. Contact the person who invited you or your administrator to get an account.",
"create_account": "Create account",
"creating": "Creating account...",
"back": "Back",
+14 -2
View File
@@ -269,7 +269,11 @@
"or_email_divider": "eller logga in med e-post",
"login_failed_title": "Inloggning misslyckades",
"login_failed_bankid": "Kunde inte slutföra BankID-inloggningen.",
"login_invalid_credentials": "Fel e-post eller lösenord.",
"login_invalid_credentials": "Fel e-postadress eller lösenord.",
"login_error_email_not_confirmed": "E-postadressen är inte bekräftad än. Klicka på länken i mejlet du fick när kontot skapades.",
"login_error_rate_limited": "För många inloggningsförsök. Vänta en stund och försök igen.",
"login_error_user_banned": "Kontot är avstängt. Kontakta supporten om du tror att det är fel.",
"login_error_reset_link": "Återställ lösenordet",
"session_idle": "Du har varit inaktiv. Logga in igen.",
"session_absolute": "Sessionen har upphört av säkerhetsskäl.",
"use_password_instead": "Logga in med e-post i stället",
@@ -925,9 +929,17 @@
"bankid_email_hint": "Används för inloggning och notifieringar.",
"invite_email_hint": "Inbjudan skickades till denna adress.",
"password_label": "Lösenord",
"password_placeholder": "Minst 8 tecken, Aa1!",
"password_placeholder": "Välj ett starkt lösenord",
"confirm_password_label": "Bekräfta lösenord",
"confirm_password_placeholder": "Upprepa lösenordet",
"password_req_length": "Minst 8 tecken",
"password_req_case": "Stora och små bokstäver",
"password_req_number": "Minst en siffra",
"password_req_special": "Minst ett specialtecken",
"password_error_requirements": "Lösenordet uppfyller inte alla krav än.",
"error_email_invalid": "E-postadressen verkar inte vara giltig. Kontrollera stavningen.",
"error_rate_limited": "För många försök. Vänta en stund och försök igen.",
"error_signup_disabled": "Kontoregistrering är avstängd på den här installationen. Kontakta den som bjöd in dig eller din administratör för att få ett konto.",
"create_account": "Skapa konto",
"creating": "Skapar konto...",
"back": "Tillbaka",