feat(api,web): auth et first-run — bootstrap admin, login, session, gardes
- api: auth controller/service, config env - web: App/LoginPage/ProfilePage, garde d'auth, client API, styles - shared: types/contrats auth - compose: variables d'environnement first-run Refs: #14
This commit is contained in:
@ -25,6 +25,25 @@ export const LoginSchema = z.object({
|
||||
});
|
||||
export type LoginDto = z.infer<typeof LoginSchema>;
|
||||
|
||||
export const AuthStatusSchema = z.object({
|
||||
hasUsers: z.boolean(),
|
||||
initialAdminEmail: z.string().email(),
|
||||
initialAdminPasswordIsDefault: z.boolean()
|
||||
});
|
||||
export type AuthStatusDto = z.infer<typeof AuthStatusSchema>;
|
||||
|
||||
export const UpdateAccountSchema = z
|
||||
.object({
|
||||
email: z.string().email().optional(),
|
||||
name: z.string().min(1).max(120).nullable().optional(),
|
||||
currentPassword: z.string().min(1),
|
||||
newPassword: z.string().min(8).optional()
|
||||
})
|
||||
.refine((value) => value.email !== undefined || value.name !== undefined || value.newPassword !== undefined, {
|
||||
message: "At least one account field must be changed"
|
||||
});
|
||||
export type UpdateAccountDto = z.infer<typeof UpdateAccountSchema>;
|
||||
|
||||
export const CreateUserSchema = z.object({
|
||||
email: z.string().email(),
|
||||
password: z.string().min(8),
|
||||
|
||||
Reference in New Issue
Block a user