Changes: - Add FAL_KEY and GEMINI_API_KEY to .env.example - Update picture-it to use ~/.config/opencode/.env (unified creds) - Remove shodh-memory skill (no longer used) - Remove alphaear-* skills (deprecated) - Remove thai-frontend-dev skill (replaced by website-creator) - Remove theme-factory skill - Add mql-developer skill (MQL5 trading) - Add ecommerce-astro skill (Astro e-commerce) - Add website-creator skill (Next.js + Payload CMS) - Update install script for new skills
70 lines
2.2 KiB
TypeScript
70 lines
2.2 KiB
TypeScript
import type { CollectionConfig } from 'payload'
|
|
import { admins, adminsOnly, adminsOrSelf, anyone } from './access'
|
|
|
|
export const Users: CollectionConfig = {
|
|
slug: 'users',
|
|
admin: {
|
|
useAsTitle: 'email',
|
|
},
|
|
auth: {
|
|
forgotPassword: {
|
|
generateEmailHTML: ({ token }) => {
|
|
const resetPasswordURL = `${process.env.SERVER_URL}/reset-password?token=${token}`
|
|
return `
|
|
<!doctype html>
|
|
<html>
|
|
<body>
|
|
<p>คุณได้รับอีเมลนี้เนื่องจากมีการขอตั้ง密码ใหม่สำหรับบัญชีของคุณ</p>
|
|
<p>กรุณาคลิกที่ลิงก์ด้านล่างเพื่อตั้ง密码ใหม่:</p>
|
|
<a href="${resetPasswordURL}">${resetPasswordURL}</a>
|
|
<p>หากคุณไม่ได้เป็นผู้ร้องขอ กรุณาเพิกเฉยต่ออีเมลนี้</p>
|
|
</body>
|
|
</html>
|
|
`
|
|
},
|
|
},
|
|
},
|
|
access: {
|
|
create: anyone, // Allow anyone to create a user account (for registration)
|
|
read: adminsOrSelf, // Allow users to read their own profile, admins can read all
|
|
update: adminsOrSelf, // Allow users to update their own profile, admins can update all
|
|
delete: admins, // Only admins can delete users
|
|
admin: adminsOnly,
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'role',
|
|
type: 'select',
|
|
options: [
|
|
{ label: 'ผู้ดูแลระบบ', value: 'admin' },
|
|
{ label: 'ผู้ใช้งาน', value: 'user' },
|
|
],
|
|
defaultValue: 'user',
|
|
required: true,
|
|
access: {
|
|
read: adminsOnly,
|
|
create: adminsOnly,
|
|
update: adminsOnly,
|
|
},
|
|
},
|
|
{
|
|
name: 'firstName',
|
|
type: 'text',
|
|
required: true,
|
|
admin: {
|
|
description: 'ชื่อจริง',
|
|
},
|
|
},
|
|
{
|
|
name: 'lastName',
|
|
type: 'text',
|
|
required: true,
|
|
admin: {
|
|
description: 'นามสกุล',
|
|
},
|
|
},
|
|
// Email is added by Payload auth automatically
|
|
// Password is handled by Payload auth automatically
|
|
],
|
|
}
|