@@ -217,13 +252,13 @@ export function AccountForm({
placeholder="กดส่ง OTP ก่อน" disabled={busy || !pendingEmail} />
}
{captcha && !pendingEmail &&
}
- {(!register || pendingEmail) &&
{register ?
อีเมล
- {email} · {verified ? "ยืนยันแล้ว" : "ยังไม่ยืนยัน"}
+ {email} - {verified ? "ยืนยันแล้ว" : "ยังไม่ยืนยัน"}
{callbackCompleted && ยืนยันขั้นตอนแล้ว หากกำลังเปลี่ยนอีเมล โปรดตรวจสอบกล่องจดหมายสำหรับขั้นตอนถัดไป}
{callbackError && ลิงก์ยืนยันไม่ถูกต้องหรือหมดอายุ กรุณาขอลิงก์ใหม่}
{message && {message}}
diff --git a/components/auth/profile-form.tsx b/components/auth/profile-form.tsx
index d83333a..79a1b86 100644
--- a/components/auth/profile-form.tsx
+++ b/components/auth/profile-form.tsx
@@ -1,7 +1,6 @@
"use client";
import { useEffect, useState, type FormEvent } from "react";
-import Link from "next/link";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
@@ -129,15 +128,6 @@ export function ProfileForm({
>
{busy ? "กำลังบันทึก..." : "บันทึกโปรไฟล์"}
- {nextPath && (
-
}
- >
- ไว้ก่อน
-
- )}
);
diff --git a/components/auth/registration-otp-form.tsx b/components/auth/registration-otp-form.tsx
index a0bbd5f..be54956 100644
--- a/components/auth/registration-otp-form.tsx
+++ b/components/auth/registration-otp-form.tsx
@@ -32,7 +32,7 @@ export function RegistrationOtpForm({ email, nextPath, setup }: {
const result = await authClient.emailOtp.verifyEmail({ email: address, otp });
if (result.error) throw new Error("รหัสไม่ถูกต้องหรือหมดอายุ กรุณาลองอีกครั้ง");
const returnPath = setup ? `/profile?setup=1&next=${encodeURIComponent(nextPath)}` : nextPath;
- router.push(`/login?verified=1&next=${encodeURIComponent(returnPath)}`);
+ router.replace(returnPath);
router.refresh();
} catch (cause) {
setError(cause instanceof Error ? cause.message : "ยืนยันอีเมลไม่สำเร็จ");
diff --git a/lib/auth/server.test.ts b/lib/auth/server.test.ts
index b3014ea..17d9721 100644
--- a/lib/auth/server.test.ts
+++ b/lib/auth/server.test.ts
@@ -63,7 +63,9 @@ describe("actual administrator session boundary", () => {
(await import("./server")).getAuth();
const options = mocks.auth.mock.calls.at(-1)![0];
expect(options.emailAndPassword.requireEmailVerification).toBe(true);
- expect(options.emailVerification).toMatchObject({ sendOnSignUp: false });
+ expect(options.emailVerification).toMatchObject({
+ sendOnSignUp: false, autoSignInAfterVerification: true,
+ });
expect(options.user.changeEmail.enabled).toBe(true);
const otp = options.plugins.find((plugin: { id?: string }) => plugin.id === "email-otp");
expect(otp.options).toMatchObject({ sendVerificationOnSignUp: true, storeOTP: "hashed" });
diff --git a/lib/auth/server.ts b/lib/auth/server.ts
index 80bc58e..a2db7a7 100644
--- a/lib/auth/server.ts
+++ b/lib/auth/server.ts
@@ -72,6 +72,7 @@ function createAuth() {
},
emailVerification: {
sendOnSignUp: false,
+ autoSignInAfterVerification: true,
sendVerificationEmail: async ({ user, url }) => {
await sendAuthEmail(user.email, "ยืนยันอีเมล Buzz Guide", `เปิดลิงก์นี้เพื่อยืนยันอีเมล: ${url}\n\nลิงก์นี้หมดอายุใน 1 ชั่วโมง`);
},
diff --git a/lib/commission/discord.ts b/lib/commission/discord.ts
index 526f10a..d6e59b6 100644
--- a/lib/commission/discord.ts
+++ b/lib/commission/discord.ts
@@ -15,7 +15,7 @@ export async function notifyPaidTicketDiscord(ticketId: string, amountBaht: numb
embeds: [{
title: "มี Ticket คอมมิชชันใหม่ที่ชำระเงินแล้ว",
url: new URL(`/admin/commission/${ticketId}`, process.env.BETTER_AUTH_URL ?? siteUrl).toString(),
- description: `Ticket #${ticketId.slice(0, 8)} · ฿${amountBaht}`,
+ description: `Ticket #${ticketId.slice(0, 8)} - ฿${amountBaht}`,
color: 0x57f287,
timestamp: new Date().toISOString(),
}],
diff --git a/lib/commission/push.ts b/lib/commission/push.ts
index a76fb91..ca46ec0 100644
--- a/lib/commission/push.ts
+++ b/lib/commission/push.ts
@@ -39,7 +39,7 @@ export async function sendCommissionMessagePush(message: {
for (let offset = 0; offset < subscriptions.length; offset += 10) {
await Promise.all(subscriptions.slice(offset, offset + 10).map(async ({ subscription }) => {
const payload = JSON.stringify({
- id: message.id, title: `${message.authorName} · ${message.ticketTitle}`,
+ id: message.id, title: `${message.authorName} - ${message.ticketTitle}`,
body: message.text?.slice(0, 300) || "ส่งรูปภาพ",
url: `/${subscription.scope === "admin" ? "admin/commission" : "commission/tickets"}/${message.ticketId}`,
});
diff --git a/next.config.ts b/next.config.ts
index 0b0bc95..a26d9b8 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -7,6 +7,10 @@ const nextConfig: NextConfig = {
async headers() {
return [{ source: "/:path*", headers: securityHeaders(process.env.NODE_ENV === "production", "https://cdn.jsdelivr.net") }];
},
+ async rewrites() {
+ // The reset-password segment resolves to the dynamic guide route in this Next version.
+ return { beforeFiles: [{ source: "/reset-password", destination: "/password-reset" }] };
+ },
cacheComponents: true,
cacheHandlers: {
remote: resolve(process.cwd(), "cache-handlers/redis-handler.cjs"),