From 94b603b83cc8613a1d4070cb7d72168f2af538fb Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Mon, 15 Dec 2025 12:15:26 +0100 Subject: [PATCH] refactor: remove 'mustChangePassword' field from user forms and related logic --- apps/infoalloggi/src/forms/FormNewUser.tsx | 27 +------------------ .../src/server/api/routers/auth.ts | 1 - .../src/server/controllers/auth.controller.ts | 3 --- 3 files changed, 1 insertion(+), 30 deletions(-) diff --git a/apps/infoalloggi/src/forms/FormNewUser.tsx b/apps/infoalloggi/src/forms/FormNewUser.tsx index 8996383..2d44e9c 100644 --- a/apps/infoalloggi/src/forms/FormNewUser.tsx +++ b/apps/infoalloggi/src/forms/FormNewUser.tsx @@ -12,7 +12,6 @@ import { import Input from "~/components/custom_ui/input"; import { PhoneInput } from "~/components/phone-input"; import { Button, buttonVariants } from "~/components/ui/button"; -import { Switch } from "~/components/ui/switch"; import { useStrongPassword } from "~/hooks/useStrongPassword"; import { generatePassword } from "~/lib/basicPwGenerator"; import { cn } from "~/lib/utils"; @@ -41,7 +40,6 @@ export const FormNewUser = ({ nome: z.string().nonempty("Inserisci un nome valido"), password: z.string(), telefono: z.string().nonempty("Inserisci un numero di telefono"), - mustChangePassword: z.boolean(), }) .superRefine(({ password }, refinementContext) => { passwordRefine({ @@ -59,7 +57,6 @@ export const FormNewUser = ({ nome: "", password: "", telefono: "", - mustChangePassword: true, }; const { locale, t } = useTranslation(); @@ -89,7 +86,6 @@ export const FormNewUser = ({ nome: fields.nome, password: fields.password, telefono: fields.telefono.replace(/\s/g, ""), - mustChangePassword: fields.mustChangePassword, }); } @@ -226,28 +222,7 @@ export const FormNewUser = ({ )} /> - ( - -
- - Forza cambio password al prossimo accesso - - - - - -
-
- )} - /> + { diff --git a/apps/infoalloggi/src/server/controllers/auth.controller.ts b/apps/infoalloggi/src/server/controllers/auth.controller.ts index 40129cf..7e76a53 100644 --- a/apps/infoalloggi/src/server/controllers/auth.controller.ts +++ b/apps/infoalloggi/src/server/controllers/auth.controller.ts @@ -26,14 +26,12 @@ export const createUserAdmin = async ({ nome, cognome, telefono, - mustChangePassword, }: { email: string; password: string; nome: string; cognome: string; telefono: string; - mustChangePassword: boolean; }) => { const banned = await isBanned({ data: { email }, db }); if (banned) { @@ -53,7 +51,6 @@ export const createUserAdmin = async ({ isAdminMade: true, nome: nome.trim(), password: hashedPassword, - mustChangePassword, salt, telefono, username: `${nome.trim()} ${cognome.trim()}`,