| 101 | return crypto.randomInt(100000, 1000000).toString(); |
| 102 | }, |
| 103 | async sendVerificationRequest({ identifier, token }) { |
| 104 | if (!serverEnv().RESEND_API_KEY) { |
| 105 | console.log("\n"); |
| 106 | console.log( |
| 107 | "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━", |
| 108 | ); |
| 109 | console.log("🔐 VERIFICATION CODE (Development Mode)"); |
| 110 | console.log( |
| 111 | "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━", |
| 112 | ); |
| 113 | console.log(`📧 Email: ${identifier}`); |
| 114 | console.log(`🔢 Code: ${token}`); |
| 115 | console.log(`⏱ Expires in: 10 minutes`); |
| 116 | console.log( |
| 117 | "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━", |
| 118 | ); |
| 119 | console.log("\n"); |
| 120 | } else { |
| 121 | const { OTPEmail } = await import("../emails/otp-email"); |
| 122 | const email = OTPEmail({ code: token, email: identifier }); |
| 123 | await sendEmail({ |
| 124 | email: identifier, |
| 125 | subject: `Your Cap Verification Code`, |
| 126 | react: email, |
| 127 | }); |
| 128 | } |
| 129 | }, |
| 130 | }), |
| 131 | ]; |
| 132 | |