File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ import dotenv from "dotenv";
44dotenv . config ( ) ;
55
66export default {
7+ security : {
8+ requireEmailVerification :
9+ process . env . REQUIRE_EMAIL_VERIFICATION === "true" || true ,
10+ } ,
711 db : {
812 user : process . env . DB_USER || "postgres" ,
913 host : process . env . DB_HOST || "localhost" ,
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
1717import { HealthCheckResponse } from "./types" ;
1818import configuration from "./config" ;
1919import { AUTHORITIES , getAccountAuthorities } from "./authorities" ;
20+ import config from "./config" ;
2021
2122export function handleRoutes ( app : Express ) {
2223 app . get ( "/" , ( req : Request , res : Response ) => {
@@ -85,7 +86,10 @@ export function handleRoutes(app: Express) {
8586 return res . status ( 401 ) . json ( { message : "Invalid credentials" } ) ;
8687 }
8788
88- if ( ! userInfo . is_email_verified ) {
89+ if (
90+ config . security . requireEmailVerification &&
91+ ! userInfo . is_email_verified
92+ ) {
8993 return res . status ( 403 ) . json ( { message : "Email is not verified" } ) ;
9094 }
9195
You can’t perform that action at this time.
0 commit comments