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 1
1
{
2
2
"name" : " chadnext" ,
3
- "version" : " 1.6 .0" ,
3
+ "version" : " 1.7 .0" ,
4
4
"private" : true ,
5
5
"scripts" : {
6
6
"dev" : " prisma generate && next dev" ,
Original file line number Diff line number Diff line change 2
2
3
3
import { revalidatePath } from "next/cache" ;
4
4
import { redirect } from "next/navigation" ;
5
- import { alphabet , generateRandomString } from "oslo /crypto" ;
5
+ import { generateRandomString , RandomReader } from "@oslojs /crypto/random " ;
6
6
import { deleteSessionTokenCookie } from "~/lib/server/cookies" ;
7
7
import prisma from "~/lib/server/prisma" ;
8
8
import { getCurrentSession , invalidateSession } from "~/lib/server/session" ;
9
9
10
+ const digits = "0123456789" ;
11
+
10
12
export async function logout ( ) {
11
13
const { session } = await getCurrentSession ( ) ;
12
14
if ( ! session ) {
@@ -30,7 +32,12 @@ export async function generateEmailVerificationCode(
30
32
userId,
31
33
} ,
32
34
} ) ;
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 ) ;
34
41
await prisma . emailVerificationCode . create ( {
35
42
data : {
36
43
userId,
You can’t perform that action at this time.
0 commit comments