Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
feat(account): add profile editing (name, email, password) (#1162)
Alcahest Malus Dienheimc0fb8b816039
diff --git a/src/components/ReferralDashboard.tsx b/src/components/ReferralDashboard.tsxindex b7a2760d7..f3973c287 100644--- a/src/components/ReferralDashboard.tsx+++ b/src/components/ReferralDashboard.tsx@@ -7,9 +7,9 @@ import { useToast } from "./ui/useToast";import { cn } from "./lib/utils";import { SpectrogramCard } from "./referral-cards/SpectrogramCard";import logger from "../utils/logger";+import { EMAIL_REGEX } from "../utils/validation";const REFERRAL_WORD_GOAL = 2000;-const RE_EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;interface ReferralStats {referralCode: string;@@ -257,7 +257,7 @@ export function ReferralDashboard() {const sendInvite = async () => {if (!emailInput.trim()) return;- if (!RE_EMAIL.test(emailInput.trim())) {+ if (!EMAIL_REGEX.test(emailInput.trim())) {toast({title: t("referral.toasts.invalidEmailTitle"),description: t("referral.toasts.invalidEmailDescription"),diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsxindex 62e715271..40639b979 100644--- a/src/components/SettingsPage.tsx+++ b/src/components/SettingsPage.tsx@@ -105,6 +105,7 @@ import { useWorkspaceStore } from "../stores/workspaceStore";import { canManageSystemAudioInApp } from "../utils/systemAudioAccess";import WorkspaceSection from "./settings/WorkspaceSection";import WorkspaceBillingOverview from "./settings/WorkspaceBillingOverview";+import ProfileSection from "./settings/ProfileSection";import { formatAmount } from "../utils/formatAmount";export type SettingsSectionType =@@ -1334,7 +1335,7 @@ export default function SettingsPage({});}, [isRemovingModels, cachePathHint, showConfirmDialog, showAlertDialog, t]);- const { isSignedIn, isLoaded, user } = useAuth();+ const { isSignedIn, isLoaded, user, refetch } = useAuth();const [isSigningOut, setIsSigningOut] = useState(false);const [isDeletingAccount, setIsDeletingAccount] = useState(false);const [isOpeningBilling, setIsOpeningBilling] = useState(false);@@ -1662,6 +1663,13 @@ export default function SettingsPage({</SettingsPanelRow></SettingsPanel>+ <ProfileSection+ name={user.name || ""}+ onSessionRefresh={() => {+ void refetch();+ }}+ />+<SettingsPanel><SettingsPanelRow><Buttondiff --git a/src/components/notes/ShareNoteDialog.tsx b/src/components/notes/ShareNoteDialog.tsxindex b60d6159d..493ea33d0 100644--- a/src/components/notes/ShareNoteDialog.tsx+++ b/src/components/notes/ShareNoteDialog.tsx@@ -31,6 +31,7 @@ import {import { useToast } from "../ui/useToast";import MemberAvatar from "../MemberAvatar";import { emailDomain, isPersonalEmailDomain } from "../../utils/personalEmailDomains";+import { EMAIL_REGEX } from "../../utils/validation";import type {NoteAccessGrant,NoteAccessState,@@ -40,7 +41,6 @@ import type {} from "../../types/electron";const SHARE_VIEWER_BASE_URL = "https://notes.openwhispr.com";-const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;interface ShareNoteDialogProps {open: boolean;diff --git a/src/components/settings/ProfileSection.tsx b/src/components/settings/ProfileSection.tsxnew file mode 100644index 000000000..1bf37812b--- /dev/null+++ b/src/components/settings/ProfileSection.tsx@@ -0,0 +1,319 @@+import React, { useCallback, useEffect, useRef, useState } from "react";+import { useTranslation } from "react-i18next";+import { AlertCircle, KeyRound, Loader2 } from "lucide-react";+import {+ changePassword,+ hasCredentialAccount,+ updateDisplayName,+ type AuthActionError,+} from "../../lib/auth";+import { Button } from "../ui/button";+import { Input } from "../ui/input";+import { Label } from "../ui/label";+import { SettingsPanel, SettingsPanelRow, SettingsRow } from "../ui/SettingsSection";+import { useToast } from "../ui/useToast";+import {+ Dialog,+ DialogContent,+ DialogHeader,+ DialogTitle,+ DialogDescription,+ DialogFooter,+} from "../ui/dialog";++const MIN_PASSWORD_LENGTH = 8;+const MAX_NAME_LENGTH = 80;++const AUTH_ERROR_KEYS: Record<string, string> = {+ INVALID_PASSWORD: "settingsPage.account.profile.errors.invalidPassword",+ PASSWORD_TOO_SHORT: "settingsPage.account.profile.errors.passwordTooShort",+ PASSWORD_TOO_LONG: "settingsPage.account.profile.errors.passwordTooLong",+ CREDENTIAL_ACCOUNT_NOT_FOUND: "settingsPage.account.profile.errors.noPassword",+};++interface ProfileSectionProps {+ name: string;+ onSessionRefresh: () => void;+}++export default function ProfileSection({ name, onSessionRefresh }: ProfileSectionProps) {+ const { t } = useTranslation();+ const { toast } = useToast();++ const [displayName, setDisplayName] = useState(name);+ // Baseline for the dirty check. Advanced on a successful save so the button+ // can't re-enable during the window before the refetched name prop lands.+ const [savedName, setSavedName] = useState(name);+ const [savingName, setSavingName] = useState(false);+ const [passwordOpen, setPasswordOpen] = useState(false);+ const [hasPassword, setHasPassword] = useState<boolean | null>(null);++ useEffect(() => {+ setDisplayName(name);+ setSavedName(name);+ }, [name]);++ useEffect(() => {+ let active = true;+ void hasCredentialAccount().then((result) => {+ if (active) setHasPassword(result);+ });+ return () => {+ active = false;+ };+ }, []);++ const describeError = useCallback(+ (error: AuthActionError) => {+ const key = error.code ? AUTH_ERROR_KEYS[error.code] : undefined;+ return key ? t(key) : t("settingsPage.account.profile.errors.generic");+ },+ [t]+ );++ const trimmedName = displayName.trim();+ const nameDirty = trimmedName.length > 0 && trimmedName !== savedName.trim();++ const handleSaveName = useCallback(async () => {+ if (!nameDirty || savingName) return;+ setSavingName(true);+ const { error } = await updateDisplayName(trimmedName);+ setSavingName(false);+ if (error) {+ toast({+ title: t("settingsPage.account.profile.name.error"),+ description: describeError(error),+ variant: "destructive",+ });+ return;+ }+ setSavedName(trimmedName);+ onSessionRefresh();+ toast({ title: t("settingsPage.account.profile.name.saved") });+ }, [nameDirty, savingName, trimmedName, toast, t, describeError, onSessionRefresh]);++ return (+ <>+ <SettingsPanel>+ <SettingsPanelRow>+ <SettingsRow label={t("settingsPage.account.profile.name.label")}>+ <div className="flex gap-2">+ <Input+ value={displayName}+ onChange={(e) => setDisplayName(e.target.value)}+ placeholder={t("settingsPage.account.profile.name.placeholder")}+ aria-label={t("settingsPage.account.profile.name.label")}+ maxLength={MAX_NAME_LENGTH}+ disabled={savingName}+ className="h-8 w-56 text-xs"+ />+ <Button size="sm" onClick={handleSaveName} disabled={!nameDirty || savingName}>+ {savingName+ ? t("settingsPage.account.profile.name.saving")+ : t("settingsPage.account.profile.name.save")}+ </Button>+ </div>+ </SettingsRow>+ </SettingsPanelRow>++ {hasPassword && (+ <SettingsPanelRow>+ <SettingsRow+ label={t("settingsPage.account.profile.password.label")}+ description={t("settingsPage.account.profile.password.description")}+ >+ <Button variant="outline" size="sm" onClick={() => setPasswordOpen(true)}>+ <KeyRound className="mr-1.5 h-3.5 w-3.5" />+ {t("settingsPage.account.profile.password.change")}+ </Button>+ </SettingsRow>+ </SettingsPanelRow>+ )}+ </SettingsPanel>++ <ChangePasswordDialog+ open={passwordOpen}+ onOpenChange={setPasswordOpen}+ describeError={describeError}+ />+ </>+ );+}++interface ChangePasswordDialogProps {+ open: boolean;+ onOpenChange: (open: boolean) => void;+ describeError: (error: AuthActionError) => string;+}++function ChangePasswordDialog({ open, onOpenChange, describeError }: ChangePasswordDialogProps) {+ const { t } = useTranslation();+ const { toast } = useToast();+ const [currentPassword, setCurrentPassword] = useState("");+ const [newPassword, setNewPassword] = useState("");+ const [confirmPassword, setConfirmPassword] = useState("");+ const [revokeOtherSessions, setRevokeOtherSessions] = useState(true);+ const [submitting, setSubmitting] = useState(false);+ const [error, setError] = useState<string | null>(null);++ const reset = useCallback(() => {+ setCurrentPassword("");+ setNewPassword("");+ setConfirmPassword("");+ setRevokeOtherSessions(true);+ setError(null);+ setSubmitting(false);+ }, []);++ // Bumped on every open/close so a response that resolves after the dialog+ // closed (or reopened) can't paint stale state into the new session.+ const sessionRef = useRef(0);++ useEffect(() => {+ sessionRef.current += 1;+ if (open) reset();+ }, [open, reset]);++ const handleOpenChange = useCallback(+ (next: boolean) => {+ if (!next) reset();+ onOpenChange(next);+ },+ [reset, onOpenChange]+ );++ const tooShort = newPassword.length > 0 && newPassword.length < MIN_PASSWORD_LENGTH;+ const mismatch = confirmPassword.length > 0 && confirmPassword !== newPassword;+ const canSubmit =+ currentPassword.length > 0 &&+ newPassword.length >= MIN_PASSWORD_LENGTH &&+ newPassword === confirmPassword &&+ !submitting;++ const handleSubmit = async (e: React.FormEvent) => {+ e.preventDefault();+ if (!canSubmit) return;+ const token = sessionRef.current;+ setSubmitting(true);+ setError(null);+ const { error: actionError } = await changePassword({+ currentPassword,+ newPassword,+ revokeOtherSessions,+ });+ if (sessionRef.current !== token) return;+ setSubmitting(false);+ if (actionError) {+ setError(describeError(actionError));+ return;+ }+ toast({ title: t("settingsPage.account.profile.password.saved") });+ handleOpenChange(false);+ };++ return (+ <Dialog open={open} onOpenChange={handleOpenChange}>+ <DialogContent className="max-w-md">+ <form onSubmit={handleSubmit} className="space-y-4">+ <DialogHeader>+ <DialogTitle>{t("settingsPage.account.profile.password.dialogTitle")}</DialogTitle>+ <DialogDescription>+ {t("settingsPage.account.profile.password.dialogDescription")}+ </DialogDescription>+ </DialogHeader>+ <div className="space-y-3">+ <div className="space-y-1.5">+ <Label htmlFor="profile-current-password" className="text-xs font-medium">+ {t("settingsPage.account.profile.password.currentLabel")}+ </Label>+ <Input+ id="profile-current-password"+ type="password"+ value={currentPassword}+ onChange={(e) => setCurrentPassword(e.target.value)}+ disabled={submitting}+ autoComplete="current-password"+ autoFocus+ />+ </div>+ <div className="space-y-1.5">+ <Label htmlFor="profile-new-password" className="text-xs font-medium">+ {t("settingsPage.account.profile.password.newLabel")}+ </Label>+ <Input+ id="profile-new-password"+ type="password"+ value={newPassword}+ onChange={(e) => setNewPassword(e.target.value)}+ minLength={MIN_PASSWORD_LENGTH}+ disabled={submitting}+ autoComplete="new-password"+ />+ {tooShort && (+ <p className="text-xs text-destructive leading-snug">+ {t("settingsPage.account.profile.password.minLength")}+ </p>+ )}+ </div>+ <div className="space-y-1.5">+ <Label htmlFor="profile-confirm-password" className="text-xs font-medium">+ {t("settingsPage.account.profile.password.confirmLabel")}+ </Label>+ <Input+ id="profile-confirm-password"+ type="password"+ value={confirmPassword}+ onChange={(e) => setConfirmPassword(e.target.value)}+ disabled={submitting}+ autoComplete="new-password"+ />+ {mismatch && (+ <p className="text-xs text-destructive leading-snug">+ {t("settingsPage.account.profile.password.mismatch")}+ </p>+ )}+ </div>+ <label className="flex items-center gap-2.5 cursor-pointer">+ <input+ type="checkbox"+ checked={revokeOtherSessions}+ onChange={(e) => setRevokeOtherSessions(e.target.checked)}+ disabled={submitting}+ className="h-3.5 w-3.5 rounded border-border accent-primary cursor-pointer"+ />+ <span className="text-xs text-foreground">+ {t("settingsPage.account.profile.password.revokeOthers")}+ </span>+ </label>+ </div>+ {error && (+ <div className="px-2.5 py-1.5 rounded bg-destructive/5 border border-destructive/20 flex items-center gap-1.5">+ <AlertCircle className="w-3 h-3 text-destructive shrink-0" />+ <p className="text-xs text-destructive leading-snug">{error}</p>+ </div>+ )}+ <DialogFooter>+ <Button+ type="button"+ variant="ghost"+ onClick={() => handleOpenChange(false)}+ disabled={submitting}+ >+ {t("settingsPage.account.profile.password.cancel")}+ </Button>+ <Button type="submit" disabled={!canSubmit}>+ {submitting ? (+ <>+ <Loader2 className="w-3.5 h-3.5 animate-spin" />+ {t("settingsPage.account.profile.password.saving")}+ </>+ ) : (+ t("settingsPage.account.profile.password.submit")+ )}+ </Button>+ </DialogFooter>+ </form>+ </DialogContent>+ </Dialog>+ );+}diff --git a/src/components/ui/label.tsx b/src/components/ui/label.tsxindex 3612044a0..e17f4c55a 100644--- a/src/components/ui/label.tsx+++ b/src/components/ui/label.tsx@@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority";import { cn } from "../lib/utils";const labelVariants = cva(- "text-sm font-medium leading-none text-neutral-700 peer-disabled:cursor-not-allowed peer-disabled:opacity-50"+ "text-sm font-medium leading-none text-neutral-700 dark:text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-50");const Label = React.forwardRef<diff --git a/src/hooks/useAuth.ts b/src/hooks/useAuth.tsindex d6649b83b..372d3d14f 100644--- a/src/hooks/useAuth.ts+++ b/src/hooks/useAuth.ts@@ -58,7 +58,7 @@ async function loadAccountDependencies() {export function useAuth() {const useSession = authClient?.useSession ?? useStaticSession;- const { data: ambientSession, isPending, error: sessionError } = useSession();+ const { data: ambientSession, isPending, error: sessionError, refetch } = useSession();const accountRevision = useSyncExternalStore(subscribeAccountScope,getAccountScopeRevision,@@ -225,5 +225,6 @@ export function useAuth() {isLoaded,session: sessionIsBound && accountScopePresentable ? ambientSession : null,user: isSignedIn ? ambientUser : null,+ refetch,};}diff --git a/src/lib/auth.ts b/src/lib/auth.tsindex 07945cd10..7779a4a95 100644--- a/src/lib/auth.ts+++ b/src/lib/auth.ts@@ -155,6 +155,7 @@ export async function deleteAccount(): Promise<{ error?: Error }> {}export async function signOut(): Promise<void> {+ credentialAccountCache = null;try {await authClient.signOut();} catch {@@ -258,3 +259,62 @@ export async function requestPasswordReset(email: string): Promise<{ error?: Errreturn { error: error instanceof Error ? error : new Error("Failed to send reset email") };}}++export interface AuthActionError extends Error {+ code?: string;+}++function toAuthActionError(source: unknown, fallbackMessage: string): AuthActionError {+ if (source instanceof Error) return source as AuthActionError;+ if (source && typeof source === "object") {+ const record = source as { message?: string; code?: string };+ const error: AuthActionError = new Error(record.message || fallbackMessage);+ if (record.code) error.code = record.code;+ return error;+ }+ return new Error(fallbackMessage);+}++export async function updateDisplayName(name: string): Promise<{ error?: AuthActionError }> {+ try {+ const { error } = await authClient.updateUser({ name });+ if (error) return { error: toAuthActionError(error, "Failed to update name") };+ return {};+ } catch (error) {+ return { error: toAuthActionError(error, "Failed to update name") };+ }+}++export async function changePassword(params: {+ currentPassword: string;+ newPassword: string;+ revokeOtherSessions: boolean;+}): Promise<{ error?: AuthActionError }> {+ try {+ const { error } = await authClient.changePassword({+ currentPassword: params.currentPassword,+ newPassword: params.newPassword,+ revokeOtherSessions: params.revokeOtherSessions,+ });+ if (error) return { error: toAuthActionError(error, "Failed to change password") };+ return {};+ } catch (error) {+ return { error: toAuthActionError(error, "Failed to change password") };+ }+}++// Cache only successful results; errors fail open without being cached. Cleared+// in signOut() so a different account never inherits a stale value.+let credentialAccountCache: boolean | null = null;++export async function hasCredentialAccount(): Promise<boolean> {+ if (credentialAccountCache !== null) return credentialAccountCache;+ try {+ const { data, error } = await authClient.listAccounts();+ if (error || !data) return true;+ credentialAccountCache = data.some((account) => account.providerId === "credential");+ return credentialAccountCache;+ } catch {+ return true;+ }+}diff --git a/src/locales/de/translation.json b/src/locales/de/translation.jsonindex ce2b0f8b0..fc659dcfe 100644--- a/src/locales/de/translation.json+++ b/src/locales/de/translation.json@@ -1592,6 +1592,40 @@"successDescription": "Ihr Konto und alle Daten wurden gelöscht. Die App wird jetzt neu geladen.","failedTitle": "Löschung fehlgeschlagen","failedDescription": "Beim Löschen Ihres Kontos ist ein Fehler aufgetreten. Ihre lokalen Daten wurden möglicherweise teilweise entfernt. Bitte versuchen Sie es erneut."+ },+ "profile": {+ "name": {+ "label": "Anzeigename",+ "placeholder": "Ihr Name",+ "save": "Speichern",+ "saving": "Wird gespeichert...",+ "saved": "Anzeigename aktualisiert",+ "error": "Ihr Name konnte nicht aktualisiert werden"+ },+ "password": {+ "label": "Passwort",+ "description": "Ändern Sie das Passwort, mit dem Sie sich anmelden.",+ "change": "Passwort ändern",+ "dialogTitle": "Passwort ändern",+ "dialogDescription": "Geben Sie Ihr aktuelles Passwort ein und wählen Sie ein neues.",+ "currentLabel": "Aktuelles Passwort",+ "newLabel": "Neues Passwort",+ "confirmLabel": "Neues Passwort bestätigen",+ "minLength": "Passwort muss mindestens 8 Zeichen lang sein",+ "mismatch": "Die Passwörter stimmen nicht überein",+ "revokeOthers": "Andere Geräte abmelden",+ "submit": "Passwort aktualisieren",+ "saving": "Wird aktualisiert...",+ "cancel": "Abbrechen",+ "saved": "Passwort aktualisiert"+ },+ "errors": {+ "invalidPassword": "Ihr aktuelles Passwort ist falsch.",+ "passwordTooShort": "Passwort muss mindestens 8 Zeichen lang sein.",+ "passwordTooLong": "Das Passwort ist zu lang.",+ "noPassword": "Für dieses Konto ist kein Passwort festgelegt.",+ "generic": "Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut."+ }}},"agentConfig": {diff --git a/src/locales/en/translation.json b/src/locales/en/translation.jsonindex b5d8216ed..253d42777 100644--- a/src/locales/en/translation.json+++ b/src/locales/en/translation.json@@ -1592,6 +1592,40 @@"successDescription": "Your account and all data have been deleted. The app will now reload.","failedTitle": "Deletion Failed","failedDescription": "Something went wrong deleting your account. Your local data may have been partially removed. Please try again."+ },+ "profile": {+ "name": {+ "label": "Display name",+ "placeholder": "Your name",+ "save": "Save",+ "saving": "Saving...",+ "saved": "Display name updated",+ "error": "Couldn't update your name"+ },+ "password": {+ "label": "Password",+ "description": "Change the password you use to sign in.",+ "change": "Change password",+ "dialogTitle": "Change password",+ "dialogDescription": "Enter your current password and choose a new one.",+ "currentLabel": "Current password",+ "newLabel": "New password",+ "confirmLabel": "Confirm new password",+ "minLength": "Password must be at least 8 characters",+ "mismatch": "Passwords don't match",+ "revokeOthers": "Sign out other devices",+ "submit": "Update password",+ "saving": "Updating...",+ "cancel": "Cancel",+ "saved": "Password updated"+ },+ "errors": {+ "invalidPassword": "Your current password is incorrect.",+ "passwordTooShort": "Password must be at least 8 characters.",+ "passwordTooLong": "Password is too long.",+ "noPassword": "No password is set for this account.",+ "generic": "Something went wrong. Please try again."+ }}},"agentConfig": {diff --git a/src/locales/es/translation.json b/src/locales/es/translation.jsonindex 2e415a34f..24871f3f7 100644--- a/src/locales/es/translation.json+++ b/src/locales/es/translation.json@@ -1362,6 +1362,40 @@"successDescription": "Tu cuenta y todos los datos han sido eliminados. La aplicación se recargará ahora.","failedTitle": "Error al eliminar","failedDescription": "Algo salió mal al eliminar tu cuenta. Es posible que tus datos locales se hayan eliminado parcialmente. Inténtalo de nuevo."+ },+ "profile": {+ "name": {+ "label": "Nombre visible",+ "placeholder": "Tu nombre",+ "save": "Guardar",+ "saving": "Guardando...",+ "saved": "Nombre visible actualizado",+ "error": "No se pudo actualizar tu nombre"+ },+ "password": {+ "label": "Contraseña",+ "description": "Cambia la contraseña que usas para iniciar sesión.",+ "change": "Cambiar contraseña",+ "dialogTitle": "Cambiar contraseña",+ "dialogDescription": "Introduce tu contraseña actual y elige una nueva.",+ "currentLabel": "Contraseña actual",+ "newLabel": "Nueva contraseña",+ "confirmLabel": "Confirmar nueva contraseña",+ "minLength": "La contraseña debe tener al menos 8 caracteres",+ "mismatch": "Las contraseñas no coinciden",+ "revokeOthers": "Cerrar sesión en otros dispositivos",+ "submit": "Actualizar contraseña",+ "saving": "Actualizando...",+ "cancel": "Cancelar",+ "saved": "Contraseña actualizada"+ },+ "errors": {+ "invalidPassword": "Tu contraseña actual es incorrecta.",+ "passwordTooShort": "La contraseña debe tener al menos 8 caracteres.",+ "passwordTooLong": "La contraseña es demasiado larga.",+ "noPassword": "Esta cuenta no tiene una contraseña configurada.",+ "generic": "Algo salió mal. Inténtalo de nuevo."+ }}},"agentConfig": {diff --git a/src/locales/fr/translation.json b/src/locales/fr/translation.jsonindex 7cbbb1628..2a2167617 100644--- a/src/locales/fr/translation.json+++ b/src/locales/fr/translation.json@@ -1592,6 +1592,40 @@"successDescription": "Votre compte et toutes les données ont été supprimés. L'application va maintenant se recharger.","failedTitle": "Échec de la suppression","failedDescription": "Une erreur s'est produite lors de la suppression de votre compte. Vos données locales ont peut-être été partiellement supprimées. Veuillez réessayer."+ },+ "profile": {+ "name": {+ "label": "Nom affiché",+ "placeholder": "Votre nom",+ "save": "Enregistrer",+ "saving": "Enregistrement...",+ "saved": "Nom affiché mis à jour",+ "error": "Impossible de mettre à jour votre nom"+ },+ "password": {+ "label": "Mot de passe",+ "description": "Modifiez le mot de passe que vous utilisez pour vous connecter.",+ "change": "Changer le mot de passe",+ "dialogTitle": "Changer le mot de passe",+ "dialogDescription": "Saisissez votre mot de passe actuel et choisissez-en un nouveau.",+ "currentLabel": "Mot de passe actuel",+ "newLabel": "Nouveau mot de passe",+ "confirmLabel": "Confirmer le nouveau mot de passe",+ "minLength": "Le mot de passe doit contenir au moins 8 caractères",+ "mismatch": "Les mots de passe ne correspondent pas",+ "revokeOthers": "Déconnecter les autres appareils",+ "submit": "Mettre à jour le mot de passe",+ "saving": "Mise à jour...",+ "cancel": "Annuler",+ "saved": "Mot de passe mis à jour"+ },+ "errors": {+ "invalidPassword": "Votre mot de passe actuel est incorrect.",+ "passwordTooShort": "Le mot de passe doit contenir au moins 8 caractères.",+ "passwordTooLong": "Le mot de passe est trop long.",+ "noPassword": "Aucun mot de passe n'est défini pour ce compte.",+ "generic": "Une erreur est survenue. Veuillez réessayer."+ }}},"agentConfig": {diff --git a/src/locales/it/translation.json b/src/locales/it/translation.jsonindex bf08540c8..979f5a1de 100644--- a/src/locales/it/translation.json+++ b/src/locales/it/translation.json@@ -1314,6 +1314,40 @@"successDescription": "Il tuo account e tutti i dati sono stati eliminati. L'app si ricaricherà ora.","failedTitle": "Eliminazione fallita","failedDescription": "Qualcosa è andato storto durante l'eliminazione del tuo account. I tuoi dati locali potrebbero essere stati parzialmente rimossi. Riprova."+ },+ "profile": {+ "name": {+ "label": "Nome visualizzato",+ "placeholder": "Il tuo nome",+ "save": "Salva",+ "saving": "Salvataggio...",+ "saved": "Nome visualizzato aggiornato",+ "error": "Impossibile aggiornare il tuo nome"+ },+ "password": {+ "label": "Password",+ "description": "Modifica la password che usi per accedere.",+ "change": "Cambia password",+ "dialogTitle": "Cambia password",+ "dialogDescription": "Inserisci la tua password attuale e scegline una nuova.",+ "currentLabel": "Password attuale",+ "newLabel": "Nuova password",+ "confirmLabel": "Conferma nuova password",+ "minLength": "La password deve essere di almeno 8 caratteri",+ "mismatch": "Le password non coincidono",+ "revokeOthers": "Disconnetti gli altri dispositivi",+ "submit": "Aggiorna password",+ "saving": "Aggiornamento...",+ "cancel": "Annulla",+ "saved": "Password aggiornata"+ },+ "errors": {+ "invalidPassword": "La tua password attuale non è corretta.",+ "passwordTooShort": "La password deve essere di almeno 8 caratteri.",+ "passwordTooLong": "La password è troppo lunga.",+ "noPassword": "Nessuna password è impostata per questo account.",+ "generic": "Qualcosa è andato storto. Riprova."+ }}},"agentConfig": {diff --git a/src/locales/ja/translation.json b/src/locales/ja/translation.jsonindex 022741473..a61f24d74 100644--- a/src/locales/ja/translation.json+++ b/src/locales/ja/translation.json@@ -1314,6 +1314,40 @@"successDescription": "アカウントとすべてのデータが削除されました。アプリが再読み込みされます。","failedTitle": "削除に失敗しました","failedDescription": "アカウントの削除中にエラーが発生しました。ローカルデータが部分的に削除された可能性があります。もう一度お試しください。"+ },+ "profile": {+ "name": {+ "label": "表示名",+ "placeholder": "お名前",+ "save": "保存",+ "saving": "保存中...",+ "saved": "表示名を更新しました",+ "error": "名前を更新できませんでした"+ },+ "password": {+ "label": "パスワード",+ "description": "サインインに使用するパスワードを変更します。",+ "change": "パスワードを変更",+ "dialogTitle": "パスワードを変更",+ "dialogDescription": "現在のパスワードを入力し、新しいパスワードを設定してください。",+ "currentLabel": "現在のパスワード",+ "newLabel": "新しいパスワード",+ "confirmLabel": "新しいパスワード(確認)",+ "minLength": "パスワードは 8 文字以上にしてください",+ "mismatch": "パスワードが一致しません",+ "revokeOthers": "他のデバイスでサインアウト",+ "submit": "パスワードを更新",+ "saving": "更新中...",+ "cancel": "キャンセル",+ "saved": "パスワードを更新しました"+ },+ "errors": {+ "invalidPassword": "現在のパスワードが正しくありません。",+ "passwordTooShort": "パスワードは 8 文字以上にしてください。",+ "passwordTooLong": "パスワードが長すぎます。",+ "noPassword": "このアカウントにはパスワードが設定されていません。",+ "generic": "問題が発生しました。もう一度お試しください。"+ }}},"agentConfig": {diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.jsonindex b649985e2..9aecfefb8 100644--- a/src/locales/pt/translation.json+++ b/src/locales/pt/translation.json@@ -1293,6 +1293,40 @@"successDescription": "Sua conta e todos os dados foram excluídos. O aplicativo será recarregado agora.","failedTitle": "Falha na exclusão","failedDescription": "Algo deu errado ao excluir sua conta. Seus dados locais podem ter sido parcialmente removidos. Tente novamente."+ },+ "profile": {+ "name": {+ "label": "Nome de exibição",+ "placeholder": "Seu nome",+ "save": "Salvar",+ "saving": "Salvando...",+ "saved": "Nome de exibição atualizado",+ "error": "Não foi possível atualizar seu nome"+ },+ "password": {+ "label": "Senha",+ "description": "Altere a senha que você usa para entrar.",+ "change": "Alterar senha",+ "dialogTitle": "Alterar senha",+ "dialogDescription": "Digite sua senha atual e escolha uma nova.",+ "currentLabel": "Senha atual",+ "newLabel": "Nova senha",+ "confirmLabel": "Confirmar nova senha",+ "minLength": "A senha deve ter pelo menos 8 caracteres",+ "mismatch": "As senhas não coincidem",+ "revokeOthers": "Sair dos outros dispositivos",+ "submit": "Atualizar senha",+ "saving": "Atualizando...",+ "cancel": "Cancelar",+ "saved": "Senha atualizada"+ },+ "errors": {+ "invalidPassword": "Sua senha atual está incorreta.",+ "passwordTooShort": "A senha deve ter pelo menos 8 caracteres.",+ "passwordTooLong": "A senha é muito longa.",+ "noPassword": "Nenhuma senha está definida para esta conta.",+ "generic": "Algo deu errado. Tente novamente."+ }}},"agentConfig": {diff --git a/src/locales/ru/translation.json b/src/locales/ru/translation.jsonindex cfd274da6..3ee2cbf2b 100644--- a/src/locales/ru/translation.json+++ b/src/locales/ru/translation.json@@ -1320,6 +1320,40 @@"successDescription": "Ваш аккаунт и все данные были удалены. Приложение сейчас перезагрузится.","failedTitle": "Ошибка удаления","failedDescription": "Что-то пошло не так при удалении вашего аккаунта. Ваши локальные данные могли быть частично удалены. Попробуйте снова."+ },+ "profile": {+ "name": {+ "label": "Отображаемое имя",+ "placeholder": "Ваше имя",+ "save": "Сохранить",+ "saving": "Сохранение...",+ "saved": "Отображаемое имя обновлено",+ "error": "Не удалось обновить ваше имя"+ },+ "password": {+ "label": "Пароль",+ "description": "Измените пароль, который вы используете для входа.",+ "change": "Изменить пароль",+ "dialogTitle": "Изменить пароль",+ "dialogDescription": "Введите текущий пароль и выберите новый.",+ "currentLabel": "Текущий пароль",+ "newLabel": "Новый пароль",+ "confirmLabel": "Подтвердите новый пароль",+ "minLength": "Пароль должен содержать не менее 8 символов",+ "mismatch": "Пароли не совпадают",+ "revokeOthers": "Выйти на других устройствах",+ "submit": "Обновить пароль",+ "saving": "Обновление...",+ "cancel": "Отмена",+ "saved": "Пароль обновлён"+ },+ "errors": {+ "invalidPassword": "Текущий пароль указан неверно.",+ "passwordTooShort": "Пароль должен содержать не менее 8 символов.",+ "passwordTooLong": "Пароль слишком длинный.",+ "noPassword": "Для этого аккаунта не установлен пароль.",+ "generic": "Что-то пошло не так. Попробуйте ещё раз."+ }}},"agentConfig": {diff --git a/src/locales/zh-CN/translation.json b/src/locales/zh-CN/translation.jsonindex f542731f7..4cf2321de 100644--- a/src/locales/zh-CN/translation.json+++ b/src/locales/zh-CN/translation.json@@ -1314,6 +1314,40 @@"successDescription": "您的账户和所有数据已被删除。应用将立即重新加载。","failedTitle": "删除失败","failedDescription": "删除您的账户时出错。您的本地数据可能已被部分删除。请重试。"+ },+ "profile": {+ "name": {+ "label": "显示名称",+ "placeholder": "您的姓名",+ "save": "保存",+ "saving": "保存中...",+ "saved": "显示名称已更新",+ "error": "无法更新您的姓名"+ },+ "password": {+ "label": "密码",+ "description": "更改您用于登录的密码。",+ "change": "更改密码",+ "dialogTitle": "更改密码",+ "dialogDescription": "输入您的当前密码并设置新密码。",+ "currentLabel": "当前密码",+ "newLabel": "新密码",+ "confirmLabel": "确认新密码",+ "minLength": "密码至少需要 8 个字符",+ "mismatch": "两次输入的密码不一致",+ "revokeOthers": "在其他设备上退出登录",+ "submit": "更新密码",+ "saving": "更新中...",+ "cancel": "取消",+ "saved": "密码已更新"+ },+ "errors": {+ "invalidPassword": "您的当前密码不正确。",+ "passwordTooShort": "密码至少需要 8 个字符。",+ "passwordTooLong": "密码过长。",+ "noPassword": "此账户未设置密码。",+ "generic": "出了点问题,请重试。"+ }}},"agentConfig": {diff --git a/src/locales/zh-TW/translation.json b/src/locales/zh-TW/translation.jsonindex 7a7fefa1f..2087fcb0d 100644--- a/src/locales/zh-TW/translation.json+++ b/src/locales/zh-TW/translation.json@@ -1314,6 +1314,40 @@"successDescription": "您的帳戶和所有資料已被刪除。應用程式將立即重新載入。","failedTitle": "刪除失敗","failedDescription": "刪除您的帳戶時發生錯誤。您的本地資料可能已被部分刪除。請重試。"+ },+ "profile": {+ "name": {+ "label": "顯示名稱",+ "placeholder": "您的姓名",+ "save": "儲存",+ "saving": "儲存中...",+ "saved": "顯示名稱已更新",+ "error": "無法更新您的姓名"+ },+ "password": {+ "label": "密碼",+ "description": "變更您用於登入的密碼。",+ "change": "變更密碼",+ "dialogTitle": "變更密碼",+ "dialogDescription": "輸入您目前的密碼並設定新密碼。",+ "currentLabel": "目前密碼",+ "newLabel": "新密碼",+ "confirmLabel": "確認新密碼",+ "minLength": "密碼至少需要 8 個字元",+ "mismatch": "兩次輸入的密碼不一致",+ "revokeOthers": "在其他裝置上登出",+ "submit": "更新密碼",+ "saving": "更新中...",+ "cancel": "取消",+ "saved": "密碼已更新"+ },+ "errors": {+ "invalidPassword": "您目前的密碼不正確。",+ "passwordTooShort": "密碼至少需要 8 個字元。",+ "passwordTooLong": "密碼過長。",+ "noPassword": "此帳戶尚未設定密碼。",+ "generic": "發生錯誤,請再試一次。"+ }}},"agentConfig": {diff --git a/src/utils/validation.ts b/src/utils/validation.tsnew file mode 100644index 000000000..34c148e31--- /dev/null+++ b/src/utils/validation.ts@@ -0,0 +1,3 @@+// Loose client-side email shape check: non-empty local part, "@", domain with a dot.+// The server is the source of truth; this only guards obviously malformed input.+export const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;