@xk2800/nextjs-template 0.6.1-beta.0 → 0.6.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/activity/logger.mjs +4 -4
- package/dist/activity/queries.d.mts +1 -1
- package/dist/activity/queries.d.ts +1 -1
- package/dist/activity/queries.mjs +3 -3
- package/dist/admin/queries.mjs +3 -3
- package/dist/auth/helpers.d.mts +0 -15
- package/dist/auth/helpers.d.ts +0 -15
- package/dist/auth/helpers.js +173 -147
- package/dist/auth/helpers.js.map +1 -1
- package/dist/auth/helpers.mjs +6 -6
- package/dist/auth/index.d.mts +3244 -5307
- package/dist/auth/index.d.ts +3244 -5307
- package/dist/auth/index.js +173 -147
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/index.mjs +6 -6
- package/dist/auth-client/index.d.mts +2353 -4792
- package/dist/auth-client/index.d.ts +2353 -4792
- package/dist/auth-client/index.js +2 -1
- package/dist/auth-client/index.js.map +1 -1
- package/dist/auth-client/index.mjs +3 -2
- package/dist/auth-client/index.mjs.map +1 -1
- package/dist/{chunk-YN4436PK.mjs → chunk-3465SI5N.mjs} +3 -9
- package/dist/{chunk-YN4436PK.mjs.map → chunk-3465SI5N.mjs.map} +1 -1
- package/dist/{chunk-HJ62TBEK.mjs → chunk-AGUEAXPN.mjs} +5 -5
- package/dist/{chunk-HJ62TBEK.mjs.map → chunk-AGUEAXPN.mjs.map} +1 -1
- package/dist/{chunk-AJRWDR65.mjs → chunk-B4FKFE7P.mjs} +4 -4
- package/dist/{chunk-AJRWDR65.mjs.map → chunk-B4FKFE7P.mjs.map} +1 -1
- package/dist/{chunk-SJE6A43W.mjs → chunk-FJAZNE3I.mjs} +3 -3
- package/dist/{chunk-SJE6A43W.mjs.map → chunk-FJAZNE3I.mjs.map} +1 -1
- package/dist/{chunk-YZPJ54QG.mjs → chunk-LPL6U5RD.mjs} +3 -3
- package/dist/{chunk-YZPJ54QG.mjs.map → chunk-LPL6U5RD.mjs.map} +1 -1
- package/dist/{chunk-WYQDMN26.mjs → chunk-ZGAODGU3.mjs} +23 -143
- package/dist/chunk-ZGAODGU3.mjs.map +1 -0
- package/dist/config/env.mjs +1 -1
- package/dist/db/index.d.mts +1 -1
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.mjs +3 -3
- package/dist/db/schema.d.mts +1 -1
- package/dist/db/schema.d.ts +1 -1
- package/dist/db/schema.mjs +2 -2
- package/dist/email-template-passkey-change-F5Q2SXHD.mjs +66 -0
- package/dist/email-template-passkey-change-F5Q2SXHD.mjs.map +1 -0
- package/dist/email-template-reset-password-QTCQNXOD.mjs +42 -0
- package/dist/email-template-reset-password-QTCQNXOD.mjs.map +1 -0
- package/dist/email-template-verify-email-WZDCCAKK.mjs +34 -0
- package/dist/email-template-verify-email-WZDCCAKK.mjs.map +1 -0
- package/dist/{schema-B2bpUUth.d.mts → schema-c2sve45Z.d.mts} +1 -1
- package/dist/{schema-B2bpUUth.d.ts → schema-c2sve45Z.d.ts} +1 -1
- package/dist/sessions/queries.mjs +3 -3
- package/dist/settings/queries.d.mts +1 -1
- package/dist/settings/queries.d.ts +1 -1
- package/dist/settings/queries.mjs +4 -4
- package/dist/types/auth/loginSchema.mjs +1 -1
- package/dist/types/auth/signupSchema.mjs +1 -1
- package/dist/users/queries.mjs +3 -3
- package/lib/auth-client.ts +2 -1
- package/lib/cookie-consent.ts +54 -0
- package/package.json +4 -2
- package/dist/chunk-WYQDMN26.mjs.map +0 -1
package/dist/auth/index.js
CHANGED
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var components = require('@react-email/components');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
3
5
|
require('server-only');
|
|
4
6
|
var betterAuth = require('better-auth');
|
|
5
7
|
var drizzle = require('better-auth/adapters/drizzle');
|
|
8
|
+
var cuid2 = require('@paralleldrive/cuid2');
|
|
6
9
|
var drizzleOrm = require('drizzle-orm');
|
|
7
10
|
var serverless = require('@neondatabase/serverless');
|
|
8
11
|
var neonHttp = require('drizzle-orm/neon-http');
|
|
9
12
|
var nodePostgres = require('drizzle-orm/node-postgres');
|
|
10
13
|
var pg = require('pg');
|
|
11
14
|
var pgCore = require('drizzle-orm/pg-core');
|
|
12
|
-
var cuid2 = require('@paralleldrive/cuid2');
|
|
13
15
|
var zod = require('zod');
|
|
14
|
-
var bcrypt = require('bcrypt');
|
|
15
16
|
var plugins = require('better-auth/plugins');
|
|
16
|
-
var passkey = require('better-auth/
|
|
17
|
+
var passkey = require('@better-auth/passkey');
|
|
17
18
|
var api = require('better-auth/api');
|
|
18
19
|
var uaParserJs = require('ua-parser-js');
|
|
19
20
|
var geoip = require('geoip-lite');
|
|
20
|
-
var resend$1 = require('resend');
|
|
21
|
-
var components = require('@react-email/components');
|
|
22
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
23
21
|
|
|
24
22
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
25
23
|
|
|
26
|
-
var bcrypt__default = /*#__PURE__*/_interopDefault(bcrypt);
|
|
27
24
|
var geoip__default = /*#__PURE__*/_interopDefault(geoip);
|
|
28
25
|
|
|
29
26
|
var __defProp = Object.defineProperty;
|
|
30
27
|
var __defProps = Object.defineProperties;
|
|
31
28
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
29
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
32
30
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
33
31
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
34
32
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -45,17 +43,162 @@ var __spreadValues = (a, b) => {
|
|
|
45
43
|
return a;
|
|
46
44
|
};
|
|
47
45
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
52
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
53
|
-
});
|
|
46
|
+
var __esm = (fn, res) => function __init() {
|
|
47
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
48
|
+
};
|
|
54
49
|
var __export = (target, all) => {
|
|
55
50
|
for (var name in all)
|
|
56
51
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
57
52
|
};
|
|
58
53
|
|
|
54
|
+
// components/email/email-template-passkey-change.tsx
|
|
55
|
+
var email_template_passkey_change_exports = {};
|
|
56
|
+
__export(email_template_passkey_change_exports, {
|
|
57
|
+
EmailTemplatePasskeyChange: () => EmailTemplatePasskeyChange
|
|
58
|
+
});
|
|
59
|
+
function EmailTemplatePasskeyChange({
|
|
60
|
+
firstName,
|
|
61
|
+
action,
|
|
62
|
+
device,
|
|
63
|
+
location,
|
|
64
|
+
ipAddress,
|
|
65
|
+
when,
|
|
66
|
+
manageUrl
|
|
67
|
+
}) {
|
|
68
|
+
const verb = action === "added" ? "added to" : "removed from";
|
|
69
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(components.Html, { children: [
|
|
70
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.Head, {}),
|
|
71
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.Tailwind, { children: /* @__PURE__ */ jsxRuntime.jsx(components.Body, { className: "bg-white font-sans", children: /* @__PURE__ */ jsxRuntime.jsx(components.Container, { className: "mx-auto max-w-[560px] px-0 pt-5 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { className: "rounded-xl bg-[#f8f9fa] p-10", children: [
|
|
72
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components.Heading, { className: "mb-3 text-center text-2xl font-bold text-[#1a1a1a]", children: [
|
|
73
|
+
"A passkey was ",
|
|
74
|
+
action
|
|
75
|
+
] }),
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "mb-6 text-base leading-6 text-[#666666]", children: [
|
|
77
|
+
"Hi ",
|
|
78
|
+
firstName,
|
|
79
|
+
", a passkey was just ",
|
|
80
|
+
verb,
|
|
81
|
+
" your account."
|
|
82
|
+
] }),
|
|
83
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components.Section, { className: "mb-6 rounded-lg bg-white p-5", children: [
|
|
84
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 mb-2 text-sm leading-5 text-[#1a1a1a]", children: [
|
|
85
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Device:" }),
|
|
86
|
+
" ",
|
|
87
|
+
device
|
|
88
|
+
] }),
|
|
89
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 mb-2 text-sm leading-5 text-[#1a1a1a]", children: [
|
|
90
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Approx. location:" }),
|
|
91
|
+
" ",
|
|
92
|
+
location
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 mb-2 text-sm leading-5 text-[#1a1a1a]", children: [
|
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "IP address:" }),
|
|
96
|
+
" ",
|
|
97
|
+
ipAddress
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 text-sm leading-5 text-[#1a1a1a]", children: [
|
|
100
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "When:" }),
|
|
101
|
+
" ",
|
|
102
|
+
when
|
|
103
|
+
] })
|
|
104
|
+
] }),
|
|
105
|
+
manageUrl && /* @__PURE__ */ jsxRuntime.jsx(components.Section, { className: "mb-6 text-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
106
|
+
components.Button,
|
|
107
|
+
{
|
|
108
|
+
href: manageUrl,
|
|
109
|
+
className: "rounded-lg bg-[#1a1a1a] px-6 py-3 text-sm font-bold text-white no-underline",
|
|
110
|
+
children: "Review your passkeys"
|
|
111
|
+
}
|
|
112
|
+
) }),
|
|
113
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.Text, { className: "text-sm leading-[22px] text-[#666666]", children: "If this was you, no action is needed. If you don't recognize it, change your password now and review your passkeys and active sessions." })
|
|
114
|
+
] }) }) }) })
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
var init_email_template_passkey_change = __esm({
|
|
118
|
+
"components/email/email-template-passkey-change.tsx"() {
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// components/email/email-template-reset-password.tsx
|
|
123
|
+
var email_template_reset_password_exports = {};
|
|
124
|
+
__export(email_template_reset_password_exports, {
|
|
125
|
+
EmailTemplateResetPassword: () => EmailTemplateResetPassword
|
|
126
|
+
});
|
|
127
|
+
function EmailTemplateResetPassword({ firstName, url }) {
|
|
128
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(components.Html, { children: [
|
|
129
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.Head, {}),
|
|
130
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.Body, { style: { backgroundColor: "#ffffff", fontFamily: "Arial, sans-serif" }, children: /* @__PURE__ */ jsxRuntime.jsx(components.Container, { style: { margin: "0 auto", padding: "20px 0 48px", maxWidth: "560px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { style: { backgroundColor: "#f8f9fa", borderRadius: "12px", padding: "40px", textAlign: "center" }, children: [
|
|
131
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.Heading, { style: { fontSize: "28px", fontWeight: "bold", marginBottom: "12px", color: "#1a1a1a" }, children: "Reset your password" }),
|
|
132
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { style: { fontSize: "16px", color: "#666666", marginBottom: "32px", lineHeight: "24px" }, children: [
|
|
133
|
+
"Hi ",
|
|
134
|
+
firstName,
|
|
135
|
+
", we got a request to reset your password. This link expires in an hour \u2014 if you didn't ask for this, you can safely ignore this email."
|
|
136
|
+
] }),
|
|
137
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.Section, { style: { marginBottom: "32px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
+
components.Button,
|
|
139
|
+
{
|
|
140
|
+
href: url,
|
|
141
|
+
style: {
|
|
142
|
+
backgroundColor: "#000000",
|
|
143
|
+
color: "#ffffff",
|
|
144
|
+
padding: "12px 32px",
|
|
145
|
+
borderRadius: "6px",
|
|
146
|
+
textDecoration: "none",
|
|
147
|
+
fontSize: "16px",
|
|
148
|
+
fontWeight: "bold"
|
|
149
|
+
},
|
|
150
|
+
children: "Reset password"
|
|
151
|
+
}
|
|
152
|
+
) }),
|
|
153
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { style: { fontSize: "13px", color: "#999999", lineHeight: "20px", wordBreak: "break-all" }, children: [
|
|
154
|
+
"Or paste this link into your browser:",
|
|
155
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
156
|
+
/* @__PURE__ */ jsxRuntime.jsx("a", { href: url, style: { color: "#000000", textDecoration: "underline" }, children: url })
|
|
157
|
+
] })
|
|
158
|
+
] }) }) })
|
|
159
|
+
] });
|
|
160
|
+
}
|
|
161
|
+
var init_email_template_reset_password = __esm({
|
|
162
|
+
"components/email/email-template-reset-password.tsx"() {
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// components/email/email-template-verify-email.tsx
|
|
167
|
+
var email_template_verify_email_exports = {};
|
|
168
|
+
__export(email_template_verify_email_exports, {
|
|
169
|
+
EmailTemplateVerifyEmail: () => EmailTemplateVerifyEmail
|
|
170
|
+
});
|
|
171
|
+
function EmailTemplateVerifyEmail({ firstName, url }) {
|
|
172
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(components.Html, { children: [
|
|
173
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.Head, {}),
|
|
174
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.Tailwind, { children: /* @__PURE__ */ jsxRuntime.jsx(components.Body, { className: "bg-white font-sans", children: /* @__PURE__ */ jsxRuntime.jsx(components.Container, { className: "mx-auto max-w-[560px] px-0 pt-5 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { className: "rounded-xl bg-[#f8f9fa] p-10 text-center", children: [
|
|
175
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.Heading, { className: "mb-3 text-[28px] font-bold text-[#1a1a1a]", children: "Confirm your email" }),
|
|
176
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "mb-8 text-base leading-6 text-[#666666]", children: [
|
|
177
|
+
"Hi ",
|
|
178
|
+
firstName,
|
|
179
|
+
", click the button below to verify this email address. If you didn't create an account, you can safely ignore this email."
|
|
180
|
+
] }),
|
|
181
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.Section, { className: "mb-8", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
182
|
+
components.Button,
|
|
183
|
+
{
|
|
184
|
+
href: url,
|
|
185
|
+
className: "rounded-md bg-black px-8 py-3 text-base font-bold text-white no-underline",
|
|
186
|
+
children: "Verify email"
|
|
187
|
+
}
|
|
188
|
+
) }),
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "text-[13px] leading-5 break-all text-[#999999]", children: [
|
|
190
|
+
"Or paste this link into your browser:",
|
|
191
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
192
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.Link, { href: url, className: "text-black underline", children: url })
|
|
193
|
+
] })
|
|
194
|
+
] }) }) }) })
|
|
195
|
+
] });
|
|
196
|
+
}
|
|
197
|
+
var init_email_template_verify_email = __esm({
|
|
198
|
+
"components/email/email-template-verify-email.tsx"() {
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
59
202
|
// server/db/schema.ts
|
|
60
203
|
var schema_exports = {};
|
|
61
204
|
__export(schema_exports, {
|
|
@@ -487,128 +630,13 @@ async function getEffectiveAuthFlags() {
|
|
|
487
630
|
}
|
|
488
631
|
var EMAIL_FROM = "Acme <onboarding@xavierkhew.xyz>";
|
|
489
632
|
var resend;
|
|
490
|
-
function getResend() {
|
|
491
|
-
if (!resend)
|
|
633
|
+
async function getResend() {
|
|
634
|
+
if (!resend) {
|
|
635
|
+
const { Resend } = await import('resend');
|
|
636
|
+
resend = new Resend(config.RESEND_API_KEY);
|
|
637
|
+
}
|
|
492
638
|
return resend;
|
|
493
639
|
}
|
|
494
|
-
function EmailTemplateResetPassword({ firstName, url }) {
|
|
495
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(components.Html, { children: [
|
|
496
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.Head, {}),
|
|
497
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.Body, { style: { backgroundColor: "#ffffff", fontFamily: "Arial, sans-serif" }, children: /* @__PURE__ */ jsxRuntime.jsx(components.Container, { style: { margin: "0 auto", padding: "20px 0 48px", maxWidth: "560px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { style: { backgroundColor: "#f8f9fa", borderRadius: "12px", padding: "40px", textAlign: "center" }, children: [
|
|
498
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.Heading, { style: { fontSize: "28px", fontWeight: "bold", marginBottom: "12px", color: "#1a1a1a" }, children: "Reset your password" }),
|
|
499
|
-
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { style: { fontSize: "16px", color: "#666666", marginBottom: "32px", lineHeight: "24px" }, children: [
|
|
500
|
-
"Hi ",
|
|
501
|
-
firstName,
|
|
502
|
-
", we got a request to reset your password. This link expires in an hour \u2014 if you didn't ask for this, you can safely ignore this email."
|
|
503
|
-
] }),
|
|
504
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.Section, { style: { marginBottom: "32px" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
505
|
-
components.Button,
|
|
506
|
-
{
|
|
507
|
-
href: url,
|
|
508
|
-
style: {
|
|
509
|
-
backgroundColor: "#000000",
|
|
510
|
-
color: "#ffffff",
|
|
511
|
-
padding: "12px 32px",
|
|
512
|
-
borderRadius: "6px",
|
|
513
|
-
textDecoration: "none",
|
|
514
|
-
fontSize: "16px",
|
|
515
|
-
fontWeight: "bold"
|
|
516
|
-
},
|
|
517
|
-
children: "Reset password"
|
|
518
|
-
}
|
|
519
|
-
) }),
|
|
520
|
-
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { style: { fontSize: "13px", color: "#999999", lineHeight: "20px", wordBreak: "break-all" }, children: [
|
|
521
|
-
"Or paste this link into your browser:",
|
|
522
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
523
|
-
/* @__PURE__ */ jsxRuntime.jsx("a", { href: url, style: { color: "#000000", textDecoration: "underline" }, children: url })
|
|
524
|
-
] })
|
|
525
|
-
] }) }) })
|
|
526
|
-
] });
|
|
527
|
-
}
|
|
528
|
-
function EmailTemplateVerifyEmail({ firstName, url }) {
|
|
529
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(components.Html, { children: [
|
|
530
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.Head, {}),
|
|
531
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.Tailwind, { children: /* @__PURE__ */ jsxRuntime.jsx(components.Body, { className: "bg-white font-sans", children: /* @__PURE__ */ jsxRuntime.jsx(components.Container, { className: "mx-auto max-w-[560px] px-0 pt-5 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { className: "rounded-xl bg-[#f8f9fa] p-10 text-center", children: [
|
|
532
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.Heading, { className: "mb-3 text-[28px] font-bold text-[#1a1a1a]", children: "Confirm your email" }),
|
|
533
|
-
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "mb-8 text-base leading-6 text-[#666666]", children: [
|
|
534
|
-
"Hi ",
|
|
535
|
-
firstName,
|
|
536
|
-
", click the button below to verify this email address. If you didn't create an account, you can safely ignore this email."
|
|
537
|
-
] }),
|
|
538
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.Section, { className: "mb-8", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
539
|
-
components.Button,
|
|
540
|
-
{
|
|
541
|
-
href: url,
|
|
542
|
-
className: "rounded-md bg-black px-8 py-3 text-base font-bold text-white no-underline",
|
|
543
|
-
children: "Verify email"
|
|
544
|
-
}
|
|
545
|
-
) }),
|
|
546
|
-
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "text-[13px] leading-5 break-all text-[#999999]", children: [
|
|
547
|
-
"Or paste this link into your browser:",
|
|
548
|
-
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
549
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.Link, { href: url, className: "text-black underline", children: url })
|
|
550
|
-
] })
|
|
551
|
-
] }) }) }) })
|
|
552
|
-
] });
|
|
553
|
-
}
|
|
554
|
-
function EmailTemplatePasskeyChange({
|
|
555
|
-
firstName,
|
|
556
|
-
action,
|
|
557
|
-
device,
|
|
558
|
-
location,
|
|
559
|
-
ipAddress,
|
|
560
|
-
when,
|
|
561
|
-
manageUrl
|
|
562
|
-
}) {
|
|
563
|
-
const verb = action === "added" ? "added to" : "removed from";
|
|
564
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(components.Html, { children: [
|
|
565
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.Head, {}),
|
|
566
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.Tailwind, { children: /* @__PURE__ */ jsxRuntime.jsx(components.Body, { className: "bg-white font-sans", children: /* @__PURE__ */ jsxRuntime.jsx(components.Container, { className: "mx-auto max-w-[560px] px-0 pt-5 pb-12", children: /* @__PURE__ */ jsxRuntime.jsxs(components.Section, { className: "rounded-xl bg-[#f8f9fa] p-10", children: [
|
|
567
|
-
/* @__PURE__ */ jsxRuntime.jsxs(components.Heading, { className: "mb-3 text-center text-2xl font-bold text-[#1a1a1a]", children: [
|
|
568
|
-
"A passkey was ",
|
|
569
|
-
action
|
|
570
|
-
] }),
|
|
571
|
-
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "mb-6 text-base leading-6 text-[#666666]", children: [
|
|
572
|
-
"Hi ",
|
|
573
|
-
firstName,
|
|
574
|
-
", a passkey was just ",
|
|
575
|
-
verb,
|
|
576
|
-
" your account."
|
|
577
|
-
] }),
|
|
578
|
-
/* @__PURE__ */ jsxRuntime.jsxs(components.Section, { className: "mb-6 rounded-lg bg-white p-5", children: [
|
|
579
|
-
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 mb-2 text-sm leading-5 text-[#1a1a1a]", children: [
|
|
580
|
-
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Device:" }),
|
|
581
|
-
" ",
|
|
582
|
-
device
|
|
583
|
-
] }),
|
|
584
|
-
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 mb-2 text-sm leading-5 text-[#1a1a1a]", children: [
|
|
585
|
-
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Approx. location:" }),
|
|
586
|
-
" ",
|
|
587
|
-
location
|
|
588
|
-
] }),
|
|
589
|
-
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 mb-2 text-sm leading-5 text-[#1a1a1a]", children: [
|
|
590
|
-
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "IP address:" }),
|
|
591
|
-
" ",
|
|
592
|
-
ipAddress
|
|
593
|
-
] }),
|
|
594
|
-
/* @__PURE__ */ jsxRuntime.jsxs(components.Text, { className: "m-0 text-sm leading-5 text-[#1a1a1a]", children: [
|
|
595
|
-
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "When:" }),
|
|
596
|
-
" ",
|
|
597
|
-
when
|
|
598
|
-
] })
|
|
599
|
-
] }),
|
|
600
|
-
manageUrl && /* @__PURE__ */ jsxRuntime.jsx(components.Section, { className: "mb-6 text-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
601
|
-
components.Button,
|
|
602
|
-
{
|
|
603
|
-
href: manageUrl,
|
|
604
|
-
className: "rounded-lg bg-[#1a1a1a] px-6 py-3 text-sm font-bold text-white no-underline",
|
|
605
|
-
children: "Review your passkeys"
|
|
606
|
-
}
|
|
607
|
-
) }),
|
|
608
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.Text, { className: "text-sm leading-[22px] text-[#666666]", children: "If this was you, no action is needed. If you don't recognize it, change your password now and review your passkeys and active sessions." })
|
|
609
|
-
] }) }) }) })
|
|
610
|
-
] });
|
|
611
|
-
}
|
|
612
640
|
|
|
613
641
|
// server/auth.ts
|
|
614
642
|
async function logFailedLogin(ctx) {
|
|
@@ -645,11 +673,12 @@ async function notifyPasskeyChange(ctx, action) {
|
|
|
645
673
|
userAgent: (_b = (_a = ctx.headers) == null ? void 0 : _a.get("user-agent")) != null ? _b : null
|
|
646
674
|
});
|
|
647
675
|
if (!config.RESEND_API_KEY) return;
|
|
648
|
-
await
|
|
676
|
+
const { EmailTemplatePasskeyChange: EmailTemplatePasskeyChange2 } = await Promise.resolve().then(() => (init_email_template_passkey_change(), email_template_passkey_change_exports));
|
|
677
|
+
await (await getResend()).emails.send({
|
|
649
678
|
from: EMAIL_FROM,
|
|
650
679
|
to: [user.email],
|
|
651
680
|
subject: action === "added" ? "A passkey was added to your account" : "A passkey was removed from your account",
|
|
652
|
-
react:
|
|
681
|
+
react: EmailTemplatePasskeyChange2({
|
|
653
682
|
firstName: user.name || "there",
|
|
654
683
|
action,
|
|
655
684
|
device: formatDeviceInfo(parseUserAgent((_d = (_c = ctx.headers) == null ? void 0 : _c.get("user-agent")) != null ? _d : null)),
|
|
@@ -708,22 +737,16 @@ function createAuth(overrides = {}) {
|
|
|
708
737
|
emailAndPassword: {
|
|
709
738
|
enabled: emailAndPasswordEnabled,
|
|
710
739
|
requireEmailVerification: false,
|
|
711
|
-
// Use bcrypt to maintain compatibility with existing user passwords
|
|
712
|
-
async hash(password) {
|
|
713
|
-
return await bcrypt__default.default.hash(password, 10);
|
|
714
|
-
},
|
|
715
|
-
async verify({ hash, password }) {
|
|
716
|
-
return await bcrypt__default.default.compare(password, hash);
|
|
717
|
-
},
|
|
718
740
|
// `url` is fully composed by better-auth (baseURL + verification token +
|
|
719
741
|
// callbackURL) — see app/(auth)/forgot-password and reset-password for
|
|
720
742
|
// the pages this points at.
|
|
721
743
|
async sendResetPassword({ user, url }) {
|
|
722
|
-
await
|
|
744
|
+
const { EmailTemplateResetPassword: EmailTemplateResetPassword2 } = await Promise.resolve().then(() => (init_email_template_reset_password(), email_template_reset_password_exports));
|
|
745
|
+
await (await getResend()).emails.send({
|
|
723
746
|
from: EMAIL_FROM,
|
|
724
747
|
to: [user.email],
|
|
725
748
|
subject: "Reset your password",
|
|
726
|
-
react:
|
|
749
|
+
react: EmailTemplateResetPassword2({ firstName: user.name || "there", url })
|
|
727
750
|
});
|
|
728
751
|
}
|
|
729
752
|
},
|
|
@@ -735,11 +758,12 @@ function createAuth(overrides = {}) {
|
|
|
735
758
|
emailVerification: {
|
|
736
759
|
autoSignInAfterVerification: true,
|
|
737
760
|
async sendVerificationEmail({ user, url }) {
|
|
738
|
-
await
|
|
761
|
+
const { EmailTemplateVerifyEmail: EmailTemplateVerifyEmail2 } = await Promise.resolve().then(() => (init_email_template_verify_email(), email_template_verify_email_exports));
|
|
762
|
+
await (await getResend()).emails.send({
|
|
739
763
|
from: EMAIL_FROM,
|
|
740
764
|
to: [user.email],
|
|
741
765
|
subject: "Confirm your email",
|
|
742
|
-
react:
|
|
766
|
+
react: EmailTemplateVerifyEmail2({ firstName: user.name || "there", url })
|
|
743
767
|
});
|
|
744
768
|
}
|
|
745
769
|
},
|
|
@@ -760,7 +784,9 @@ function createAuth(overrides = {}) {
|
|
|
760
784
|
},
|
|
761
785
|
// Advanced options
|
|
762
786
|
advanced: {
|
|
763
|
-
|
|
787
|
+
database: {
|
|
788
|
+
generateId: () => cuid2.createId()
|
|
789
|
+
}
|
|
764
790
|
},
|
|
765
791
|
// Every new session row corresponds to a sign-in (credential or OAuth) —
|
|
766
792
|
// use that as the "last logged in" signal rather than session updates,
|