remove duplicate folder and fix sending email
Build & Deploy / Build & Push Docker Image (push) Failing after 49s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / API Unit Tests (push) Failing after 5m3s
Test / Marketplace Unit Tests (push) Has been cancelled
Test / Admin Unit Tests (push) Has been cancelled
Test / Dashboard Unit Tests (push) Has been cancelled
Test / API Integration Tests (push) Has been cancelled
Build & Deploy / Build & Push Docker Image (push) Failing after 49s
Build & Deploy / Deploy to VPS (push) Has been skipped
Test / API Unit Tests (push) Failing after 5m3s
Test / Marketplace Unit Tests (push) Has been cancelled
Test / Admin Unit Tests (push) Has been cancelled
Test / Dashboard Unit Tests (push) Has been cancelled
Test / API Integration Tests (push) Has been cancelled
This commit is contained in:
@@ -121,7 +121,9 @@ export async function startAccount(body: AccountStartInput) {
|
||||
html: emailBodies[lang],
|
||||
text: emailTexts[lang],
|
||||
}).catch((err) => {
|
||||
console.error('[AccountStart] Verification email delivery failed:', err?.message)
|
||||
console.error('[AccountStart] Verification email delivery failed:', err?.message ?? String(err))
|
||||
console.error('[AccountStart] SMTP config — host:', process.env.MAIL_HOST ?? 'not set', '| port:', process.env.MAIL_PORT ?? 'not set', '| user:', process.env.MAIL_USERNAME ? '***' : 'not set', '| pass:', process.env.MAIL_PASSWORD ? '***' : 'not set')
|
||||
console.error('[AccountStart] Resend config — apiKey:', process.env.RESEND_API_KEY ? (process.env.RESEND_API_KEY.startsWith('re_') ? 'valid' : 'placeholder') : 'not set')
|
||||
})
|
||||
|
||||
return {
|
||||
|
||||
@@ -224,7 +224,9 @@ export async function resendVerification(email: string) {
|
||||
html: `<p>Click the link below to verify your email and activate your account:</p><p><a href="${verifyUrl}">Verify Email</a></p>`,
|
||||
text: `Verify your email by visiting:\n${verifyUrl}`,
|
||||
}).catch((err) => {
|
||||
console.error('[ResendVerification] Email delivery failed:', err?.message)
|
||||
console.error('[ResendVerification] Email delivery failed:', err?.message ?? String(err))
|
||||
console.error('[ResendVerification] SMTP config — host:', process.env.MAIL_HOST ?? 'not set', '| port:', process.env.MAIL_PORT ?? 'not set', '| user:', process.env.MAIL_USERNAME ? '***' : 'not set')
|
||||
console.error('[ResendVerification] Resend config — apiKey:', process.env.RESEND_API_KEY ? (process.env.RESEND_API_KEY.startsWith('re_') ? 'valid' : 'placeholder') : 'not set')
|
||||
})
|
||||
|
||||
return { message: 'A new verification link has been sent to your email.' }
|
||||
|
||||
@@ -11,6 +11,7 @@ export default function VerifyEmailPage() {
|
||||
const searchParams = useSearchParams()
|
||||
const token = searchParams.get('token')
|
||||
const [status, setStatus] = useState<'loading' | 'success' | 'error'>('loading')
|
||||
const [errorDetail, setErrorDetail] = useState<string | null>(null)
|
||||
|
||||
const dict = {
|
||||
en: {
|
||||
@@ -44,7 +45,8 @@ export default function VerifyEmailPage() {
|
||||
async function verify() {
|
||||
try {
|
||||
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:4000/api/v1'
|
||||
const res = await fetch(`${API_BASE}/auth/employee/verify-email`, {
|
||||
const url = `${API_BASE}/auth/employee/verify-email`
|
||||
const res = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ token }),
|
||||
@@ -55,10 +57,22 @@ export default function VerifyEmailPage() {
|
||||
if (res.ok) {
|
||||
setStatus('success')
|
||||
} else {
|
||||
let detail = `API returned ${res.status}`
|
||||
try {
|
||||
const body = await res.json()
|
||||
if (body?.error) detail += `: ${body.error}`
|
||||
if (body?.message) detail += ` — ${body.message}`
|
||||
} catch {
|
||||
// response wasn't JSON
|
||||
}
|
||||
setErrorDetail(detail)
|
||||
setStatus('error')
|
||||
}
|
||||
} catch (err: any) {
|
||||
if (!cancelled) {
|
||||
setErrorDetail(err?.message ?? 'Network error — could not reach the API')
|
||||
setStatus('error')
|
||||
}
|
||||
} catch {
|
||||
if (!cancelled) setStatus('error')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +129,9 @@ export default function VerifyEmailPage() {
|
||||
</svg>
|
||||
</div>
|
||||
<h1 className="text-xl font-black text-blue-950 dark:text-stone-50">{dict.error}</h1>
|
||||
{errorDetail && (
|
||||
<p className="mt-2 text-xs text-stone-500 dark:text-stone-400 font-mono break-all">{errorDetail}</p>
|
||||
)}
|
||||
<a
|
||||
href="/sign-in"
|
||||
className="mt-6 inline-flex justify-center rounded-full bg-orange-600 px-6 py-3 text-sm font-semibold text-white transition hover:bg-orange-700 dark:bg-orange-500 dark:hover:bg-orange-400"
|
||||
|
||||
Reference in New Issue
Block a user