Correct verification URL
This commit is contained in:
parent
8d70ac3d19
commit
27bb067779
2 changed files with 7 additions and 3 deletions
|
@ -1,12 +1,12 @@
|
||||||
import type { Email, VerificationCode } from "$lib/types";
|
import type { Email, VerificationCode } from "$lib/types";
|
||||||
import { sendEmail } from ".";
|
import { sendEmail } from ".";
|
||||||
|
|
||||||
export function sendVerificationEmail(email: Email, verificationCode: VerificationCode) {
|
export function sendVerificationEmail(email: Email, verificationCode: VerificationCode, baseUrl: string) {
|
||||||
sendEmail(email, 'Welcome to Three60 surveys', `Hello,
|
sendEmail(email, 'Welcome to Three60 surveys', `Hello,
|
||||||
|
|
||||||
please confirm your account email address by clicking the link below:
|
please confirm your account email address by clicking the link below:
|
||||||
|
|
||||||
http://localhost:5173/verify/${verificationCode}
|
${baseUrl}/verify/${verificationCode}
|
||||||
|
|
||||||
Thank you.
|
Thank you.
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,10 @@ export const load: PageServerLoad = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getBaseUrl(requestUrl: URL) {
|
||||||
|
return `${requestUrl.protocol}//${requestUrl.host}`
|
||||||
|
}
|
||||||
|
|
||||||
export const actions = {
|
export const actions = {
|
||||||
default: async (event) => {
|
default: async (event) => {
|
||||||
const formData = await event.request.formData();
|
const formData = await event.request.formData();
|
||||||
|
@ -28,7 +32,7 @@ export const actions = {
|
||||||
const result = await createNewUser(email, password);
|
const result = await createNewUser(email, password);
|
||||||
|
|
||||||
if (result.verificationCode) {
|
if (result.verificationCode) {
|
||||||
sendVerificationEmail(email, result.verificationCode);
|
sendVerificationEmail(email, result.verificationCode, getBaseUrl(event.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect(303, '/register/success');
|
redirect(303, '/register/success');
|
||||||
|
|
Loading…
Add table
Reference in a new issue