mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-14 06:47:00 +10:00
Merge pull request #1843 from abizek/fix/tfa-length-error-message
Fix(tfa): error message for tfa code length
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { t } from "@lingui/macro";
|
||||
import { i18n } from "@lingui/core";
|
||||
import { msg, t } from "@lingui/macro";
|
||||
import { QrCode } from "@phosphor-icons/react";
|
||||
import {
|
||||
Alert,
|
||||
@@ -46,8 +47,9 @@ import { useDialog } from "@/client/stores/dialog";
|
||||
|
||||
const formSchema = z.object({
|
||||
uri: z.literal("").or(z.string().optional()),
|
||||
// eslint-disable-next-line lingui/t-call-in-function
|
||||
code: z.literal("").or(z.string().regex(/^\d{6}$/, t`Code must be exactly 6 digits long.`)),
|
||||
code: z
|
||||
.literal("")
|
||||
.or(z.string().regex(/^\d{6}$/, i18n._(msg`Code must be exactly 6 digits long.`))),
|
||||
backupCodes: z.array(z.string()),
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@ import { createZodDto } from "nestjs-zod/dto";
|
||||
import { z } from "nestjs-zod/z";
|
||||
|
||||
export const twoFactorSchema = z.object({
|
||||
code: z.string().length(6).regex(/^\d+$/, { message: "code must be a 6 digit number" }),
|
||||
code: z
|
||||
.string()
|
||||
.length(6, { message: "Code must be a 6 digit number" })
|
||||
.regex(/^\d+$/, { message: "Code must be a 6 digit number" }),
|
||||
});
|
||||
|
||||
export class TwoFactorDto extends createZodDto(twoFactorSchema) {}
|
||||
|
||||
Reference in New Issue
Block a user