File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 11import { query } from "../utils/db" ;
22
3- type accountInfo = {
3+ type Account = {
44 id : number ;
55 password : string ;
6+ is_email_verified : boolean ;
67} ;
78
89export async function queryAccountInfoByEmail (
910 email : string
10- ) : Promise < accountInfo | null > {
11+ ) : Promise < Account | null > {
1112 try {
1213 const result = await query (
1314 "SELECT id,password FROM accounts WHERE email = $1" ,
Original file line number Diff line number Diff line change @@ -85,6 +85,10 @@ export function handleRoutes(app: Express) {
8585 return res . status ( 401 ) . json ( { message : "Invalid credentials" } ) ;
8686 }
8787
88+ if ( ! userInfo . is_email_verified ) {
89+ return res . status ( 403 ) . json ( { message : "Email is not verified" } ) ;
90+ }
91+
8892 const token = generateToken ( { email : email , sub : userInfo . id } ) ;
8993
9094 res . json ( { token } ) ;
You can’t perform that action at this time.
0 commit comments