-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zk: auth user register email create email pass body
- Loading branch information
Showing
4 changed files
with
75 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
packages/services/auth/src/utils/generateVerificationCode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const generateVerificationCode = () => { | ||
// Get current timestamp in milliseconds | ||
const timestamp = new Date().getTime().toString(); | ||
|
||
// Generate a random 2-digit number | ||
const randomNum = Math.floor(10 + Math.random() * 90); // Ensures 2-digit random number | ||
|
||
// Combine timestamp and random number and extract last 5 digits | ||
let code = (timestamp + randomNum).slice(-5); | ||
|
||
return code; | ||
|
||
} | ||
|
||
export default generateVerificationCode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
import prisma from "@/utils/prisma" | ||
import { Request, Response,NextFunction } from "express" | ||
|
||
const getEmail = async (req: Request, res: Response, next: NextFunction) => { | ||
|
||
const getEmails = async (req: Request, res: Response, next: NextFunction) => { | ||
try { | ||
const emails = await prisma.email.findMany() | ||
|
||
res.status(200).json(emails) | ||
} catch (error) { | ||
next(error) | ||
} | ||
} | ||
|
||
export default getEmail | ||
export default getEmails |