@stnd/account 0.3.1 → 0.4.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/CHANGELOG.md +13 -0
- package/auth.js +10 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/auth.js
CHANGED
|
@@ -74,6 +74,9 @@ export function initAuth(env) {
|
|
|
74
74
|
log.debug("[initAuth] Calling betterAuth(...)");
|
|
75
75
|
|
|
76
76
|
const resolvedBaseURL = resolveConfigValue(accountConfig.baseURL, env);
|
|
77
|
+
const appName = accountConfig.rpName || env.RP_NAME || "Standard Garden";
|
|
78
|
+
const rawEmailFrom = accountConfig.emailFrom || env.EMAIL_FROM || "auth@standard.garden";
|
|
79
|
+
const fromHeader = rawEmailFrom.includes("<") ? rawEmailFrom : `${appName} <${rawEmailFrom}>`;
|
|
77
80
|
const resolvedTrustedOrigins = resolveConfigValue(
|
|
78
81
|
accountConfig.trustedOrigins,
|
|
79
82
|
env,
|
|
@@ -181,7 +184,7 @@ export function initAuth(env) {
|
|
|
181
184
|
plugins: [
|
|
182
185
|
passkey({
|
|
183
186
|
rpID: accountConfig.rpID || env.RP_ID || "localhost",
|
|
184
|
-
rpName:
|
|
187
|
+
rpName: appName,
|
|
185
188
|
}),
|
|
186
189
|
magicLink({
|
|
187
190
|
sendMagicLink: async ({ email, token, url }) => {
|
|
@@ -201,9 +204,9 @@ export function initAuth(env) {
|
|
|
201
204
|
"Content-Type": "application/json",
|
|
202
205
|
},
|
|
203
206
|
body: JSON.stringify({
|
|
204
|
-
from:
|
|
207
|
+
from: fromHeader,
|
|
205
208
|
to: email,
|
|
206
|
-
subject: `Your login link to ${
|
|
209
|
+
subject: `Your login link to ${appName}`,
|
|
207
210
|
headers: {
|
|
208
211
|
"List-Unsubscribe": `<${resolvedBaseURL || "https://standard.garden"}>, <mailto:support@standard.garden?subject=unsubscribe>`,
|
|
209
212
|
},
|
|
@@ -215,7 +218,7 @@ export function initAuth(env) {
|
|
|
215
218
|
<p style="margin-top:24px; color:#666; font-size:14px;">This link expires in 15 minutes.</p>
|
|
216
219
|
<hr style="border:none; border-top:1px solid #e5e7eb; margin:24px 0;" />
|
|
217
220
|
<p style="color:#888; font-size:12px; line-height:1.5; margin:0;">
|
|
218
|
-
Vous recevez ce courriel suite à une demande de connexion sur ${
|
|
221
|
+
Vous recevez ce courriel suite à une demande de connexion sur ${appName}.<br />
|
|
219
222
|
Pour gérer vos préférences, vous désinscrire ou exercer votre droit à l'oubli, accédez à vos <a href="${resolvedBaseURL || "https://standard.garden"}" style="color:#444; text-decoration:underline;">paramètres de compte</a>.
|
|
220
223
|
</p>
|
|
221
224
|
</div>
|
|
@@ -246,7 +249,7 @@ export function initAuth(env) {
|
|
|
246
249
|
"Content-Type": "application/json",
|
|
247
250
|
},
|
|
248
251
|
body: JSON.stringify({
|
|
249
|
-
from:
|
|
252
|
+
from: fromHeader,
|
|
250
253
|
to: email,
|
|
251
254
|
subject: `Your login code: ${otp}`,
|
|
252
255
|
headers: {
|
|
@@ -255,14 +258,14 @@ export function initAuth(env) {
|
|
|
255
258
|
html: `
|
|
256
259
|
<div style="font-family: system-ui, sans-serif; max-width: 600px; margin: 0 auto; color: #111;">
|
|
257
260
|
<h1>Your Login Code</h1>
|
|
258
|
-
<p>Use the following code to sign in to ${
|
|
261
|
+
<p>Use the following code to sign in to ${appName}:</p>
|
|
259
262
|
<div style="font-size: 32px; font-weight: bold; letter-spacing: 4px; padding: 20px; background: #f4f4f5; text-align: center; border-radius: 8px; margin: 24px 0;">
|
|
260
263
|
${otp}
|
|
261
264
|
</div>
|
|
262
265
|
<p style="color:#666; font-size:14px;">This code expires in 10 minutes.</p>
|
|
263
266
|
<hr style="border:none; border-top:1px solid #e5e7eb; margin:24px 0;" />
|
|
264
267
|
<p style="color:#888; font-size:12px; line-height:1.5; margin:0;">
|
|
265
|
-
Vous recevez ce courriel suite à une demande de connexion sur ${
|
|
268
|
+
Vous recevez ce courriel suite à une demande de connexion sur ${appName}.<br />
|
|
266
269
|
Pour gérer vos préférences, vous désinscrire ou exercer votre droit à l'oubli, accédez à vos <a href="${resolvedBaseURL || "https://standard.garden"}" style="color:#444; text-decoration:underline;">paramètres de compte</a>.
|
|
267
270
|
</p>
|
|
268
271
|
</div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stnd/account",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"svelte": "./ui/UserMenu.svelte",
|
|
6
6
|
"main": "./index.module.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@stnd/art": "0.1.3",
|
|
27
27
|
"@stnd/icon": "0.7.0",
|
|
28
28
|
"@stnd/log": "0.5.2",
|
|
29
|
-
"@stnd/styles": "0.14.
|
|
29
|
+
"@stnd/styles": "0.14.2",
|
|
30
30
|
"@stnd/utils": "0.7.3"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|