File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " chadnext" ,
3- "version" : " 1.6 .0" ,
3+ "version" : " 1.7 .0" ,
44 "private" : true ,
55 "scripts" : {
66 "dev" : " prisma generate && next dev" ,
Original file line number Diff line number Diff line change 22
33import { revalidatePath } from "next/cache" ;
44import { redirect } from "next/navigation" ;
5- import { alphabet , generateRandomString } from "oslo /crypto" ;
5+ import { generateRandomString , RandomReader } from "@oslojs /crypto/random " ;
66import { deleteSessionTokenCookie } from "~/lib/server/cookies" ;
77import prisma from "~/lib/server/prisma" ;
88import { getCurrentSession , invalidateSession } from "~/lib/server/session" ;
99
10+ const digits = "0123456789" ;
11+
1012export async function logout ( ) {
1113 const { session } = await getCurrentSession ( ) ;
1214 if ( ! session ) {
@@ -30,7 +32,12 @@ export async function generateEmailVerificationCode(
3032 userId,
3133 } ,
3234 } ) ;
33- const code = generateRandomString ( 6 , alphabet ( "0-9" ) ) ;
35+ const random : RandomReader = {
36+ read ( bytes ) {
37+ crypto . getRandomValues ( bytes ) ;
38+ } ,
39+ } ;
40+ const code = generateRandomString ( random , digits , 6 ) ;
3441 await prisma . emailVerificationCode . create ( {
3542 data : {
3643 userId,
You can’t perform that action at this time.
0 commit comments