Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
KMKoushik committed Mar 31, 2024
1 parent 7fbd9ea commit 9f6398e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
5 changes: 2 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/components/ui/input-otp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ const InputOTPSlot = React.forwardRef<
React.ComponentPropsWithoutRef<'div'> & { index: number | string }
>(({ index, className, ...props }, ref) => {
const inputOTPContext = React.useContext(OTPInputContext);
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[Number(index)] ?? {
char: '',
hasFakeCaret: false,
isActive: false,
};

return (
<div
ref={ref}
className={cn(
'relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md',
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
isActive && 'z-10 ring-2 ring-ring ring-offset-background',
className,
)}
Expand Down
19 changes: 12 additions & 7 deletions src/pages/auth/signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function Home() {

window.location.href = `/api/auth/callback/email?email=${encodeURIComponent(
email.toLowerCase(),
)}&token=${values.otp}${callbackUrl ? `&callbackUrl=${callbackUrl}/balances` : ''}`;
)}&token=${values.otp.toLowerCase()}${callbackUrl ? `&callbackUrl=${callbackUrl}/balances` : ''}`;
}

return (
Expand Down Expand Up @@ -107,13 +107,18 @@ export default function Home() {
render={({ field }) => (
<FormItem>
<FormControl>
<InputOTP maxLength={5} pattern={REGEXP_ONLY_DIGITS_AND_CHARS} {...field}>
<InputOTP
className="w-[300px]"
maxLength={5}
pattern={REGEXP_ONLY_DIGITS_AND_CHARS}
{...field}
>
<InputOTPGroup>
<InputOTPSlot index={0} />
<InputOTPSlot index={1} />
<InputOTPSlot index={2} />
<InputOTPSlot index={3} />
<InputOTPSlot index={4} />
<InputOTPSlot className="w-[60px]" index={0} />
<InputOTPSlot className="w-[60px]" index={1} />
<InputOTPSlot className="w-[60px]" index={2} />
<InputOTPSlot className="w-[60px]" index={3} />
<InputOTPSlot className="w-[60px]" index={4} />
</InputOTPGroup>
</InputOTP>
</FormControl>
Expand Down
2 changes: 1 addition & 1 deletion src/server/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const authOptions: NextAuthOptions = {
await sendSignUpEmail(email, token, url);
},
async generateVerificationToken() {
return Math.random().toString(36).substring(2, 7);
return Math.random().toString(36).substring(2, 7).toLowerCase();
},
}),
],
Expand Down

0 comments on commit 9f6398e

Please sign in to comment.