remember me fix
This commit is contained in:
@@ -910,7 +910,7 @@ export const authRouter = createTRPCRouter({
|
||||
emailRegistration: publicProcedure
|
||||
.input(registerUserSchema)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
const { email, password, passwordConfirmation } = input;
|
||||
const { email, password, passwordConfirmation, rememberMe } = input;
|
||||
|
||||
// Apply rate limiting
|
||||
const clientIP = getClientIP(getH3Event(ctx));
|
||||
@@ -977,7 +977,7 @@ export const authRouter = createTRPCRouter({
|
||||
await createAuthSession(
|
||||
getH3Event(ctx),
|
||||
userId,
|
||||
true, // Always use persistent sessions
|
||||
rememberMe ?? true, // Default to persistent sessions for registration
|
||||
clientIP,
|
||||
userAgent
|
||||
);
|
||||
|
||||
@@ -48,7 +48,8 @@ export const registerUserSchema = z
|
||||
.object({
|
||||
email: z.string().email(),
|
||||
password: securePasswordSchema,
|
||||
passwordConfirmation: z.string().min(VALIDATION_CONFIG.MIN_PASSWORD_LENGTH)
|
||||
passwordConfirmation: z.string().min(VALIDATION_CONFIG.MIN_PASSWORD_LENGTH),
|
||||
rememberMe: z.boolean().optional().default(true)
|
||||
})
|
||||
.refine((data) => data.password === data.passwordConfirmation, {
|
||||
message: "Passwords do not match",
|
||||
@@ -60,7 +61,8 @@ export const registerUserSchema = z
|
||||
*/
|
||||
export const loginUserSchema = z.object({
|
||||
email: z.string().email(),
|
||||
password: z.string().min(1, "Password is required")
|
||||
password: z.string().min(1, "Password is required"),
|
||||
rememberMe: z.boolean().optional().default(false)
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user