File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ const EnvironmentSchema = z
59
59
ADMIN_EMAILS : z . string ( ) . refine ( isValidRegex , "ADMIN_EMAILS must be a valid regex." ) . optional ( ) ,
60
60
REMIX_APP_PORT : z . string ( ) . optional ( ) ,
61
61
LOGIN_ORIGIN : z . string ( ) . default ( "http://localhost:3030" ) ,
62
+ LOGIN_RATE_LIMITS_ENABLED : z . enum ( [ "0" , "1" ] ) . default ( "1" ) ,
62
63
APP_ORIGIN : z . string ( ) . default ( "http://localhost:3030" ) ,
63
64
API_ORIGIN : z . string ( ) . optional ( ) ,
64
65
STREAM_ORIGIN : z . string ( ) . optional ( ) ,
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import {
29
29
checkMagicLinkIpRateLimit ,
30
30
} from "~/services/magicLinkRateLimiter.server" ;
31
31
import { logger , tryCatch } from "@trigger.dev/core/v3" ;
32
+ import { env } from "~/env.server" ;
32
33
33
34
export const meta : MetaFunction = ( { matches } ) => {
34
35
const parentMeta = matches
@@ -96,6 +97,13 @@ export async function action({ request }: ActionFunctionArgs) {
96
97
97
98
switch ( data . action ) {
98
99
case "send" : {
100
+ if ( env . LOGIN_RATE_LIMITS_ENABLED !== "1" ) {
101
+ return authenticator . authenticate ( "email-link" , request , {
102
+ successRedirect : "/login/magic" ,
103
+ failureRedirect : "/login/magic" ,
104
+ } ) ;
105
+ }
106
+
99
107
const { email } = data ;
100
108
const clientIp = request . headers . get ( "x-forwarded-for" ) ;
101
109
You can’t perform that action at this time.
0 commit comments