feat: add editorial registration and authentication
This commit is contained in:
1 parent
7acaacb92e
commit
9b22752ef2
20 files changed
+1728
-20
No files matched your search
@@ -16,8 +16,11 @@
|
||||
"test:e2e": "playwright test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@better-auth/drizzle-adapter": "^1.6.26",
|
||||
"better-auth": "^1.6.26",
|
||||
"drizzle-orm": "^0.45.2",
|
||||
"next": "^16.3.0",
|
||||
"nodemailer": "^9.0.5",
|
||||
"pg": "^8.22.0",
|
||||
"react": "^19.2.8",
|
||||
"react-dom": "^19.2.8",
|
||||
@@ -30,6 +33,7 @@
|
||||
"@testing-library/jest-dom": "^7.0.0",
|
||||
"@testing-library/react": "^16.3.2",
|
||||
"@types/node": "^24.13.3",
|
||||
"@types/nodemailer": "^8.0.1",
|
||||
"@types/pg": "^8.21.0",
|
||||
"@types/react": "^19.2.18",
|
||||
"@types/react-dom": "^19.2.4",
|
||||
|
||||
Generated
+347
-20
@@ -8,12 +8,21 @@ importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
'@better-auth/drizzle-adapter':
|
||||
specifier: ^1.6.26
|
||||
version: 1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)(drizzle-orm@0.45.2(@types/pg@8.21.0)(kysely@0.29.4)(pg@8.22.0))
|
||||
better-auth:
|
||||
specifier: ^1.6.26
|
||||
version: 1.6.26(drizzle-kit@0.31.10)(drizzle-orm@0.45.2(@types/pg@8.21.0)(kysely@0.29.4)(pg@8.22.0))(next@16.3.0(@babel/core@7.29.7(supports-color@7.2.0))(@types/node@24.13.3)(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(pg@8.22.0)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(vitest@4.1.10(@types/node@24.13.3)(jsdom@30.0.1(@noble/hashes@2.3.0))(vite@8.2.1(@types/node@24.13.3)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.23.11)(yaml@2.9.0)))
|
||||
drizzle-orm:
|
||||
specifier: ^0.45.2
|
||||
version: 0.45.2(@types/pg@8.21.0)(pg@8.22.0)
|
||||
version: 0.45.2(@types/pg@8.21.0)(kysely@0.29.4)(pg@8.22.0)
|
||||
next:
|
||||
specifier: ^16.3.0
|
||||
version: 16.3.0(@babel/core@7.29.7(supports-color@7.2.0))(@types/node@24.13.3)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
|
||||
nodemailer:
|
||||
specifier: ^9.0.5
|
||||
version: 9.0.5
|
||||
pg:
|
||||
specifier: ^8.22.0
|
||||
version: 8.22.0
|
||||
@@ -45,6 +54,9 @@ importers:
|
||||
'@types/node':
|
||||
specifier: ^24.13.3
|
||||
version: 24.13.3
|
||||
'@types/nodemailer':
|
||||
specifier: ^8.0.1
|
||||
version: 8.0.1
|
||||
'@types/pg':
|
||||
specifier: ^8.21.0
|
||||
version: 8.21.0
|
||||
@@ -68,7 +80,7 @@ importers:
|
||||
version: 16.3.0(@typescript-eslint/parser@8.66.0(eslint@9.39.5(jiti@2.7.0)(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3))(eslint@9.39.5(jiti@2.7.0)(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3)
|
||||
jsdom:
|
||||
specifier: ^30.0.1
|
||||
version: 30.0.1
|
||||
version: 30.0.1(@noble/hashes@2.3.0)
|
||||
tailwindcss:
|
||||
specifier: ^4.3.3
|
||||
version: 4.3.3
|
||||
@@ -80,7 +92,7 @@ importers:
|
||||
version: 5.9.3
|
||||
vitest:
|
||||
specifier: ^4.1.10
|
||||
version: 4.1.10(@types/node@24.13.3)(jsdom@30.0.1)(vite@8.2.1(@types/node@24.13.3)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.23.11)(yaml@2.9.0))
|
||||
version: 4.1.10(@types/node@24.13.3)(jsdom@30.0.1(@noble/hashes@2.3.0))(vite@8.2.1(@types/node@24.13.3)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.23.11)(yaml@2.9.0))
|
||||
|
||||
packages:
|
||||
|
||||
@@ -173,6 +185,88 @@ packages:
|
||||
'@balena/dockerignore@1.0.2':
|
||||
resolution: {integrity: sha512-wMue2Sy4GAVTk6Ic4tJVcnfdau+gx2EnG7S+uAEe+TWJFqE4YoWN4/H8MSLj4eYJKxGg26lZwboEniNiNwZQ6Q==}
|
||||
|
||||
'@better-auth/core@1.6.26':
|
||||
resolution: {integrity: sha512-Ud4FqnjIJDvmeo+3bN+OsuVVAiuvFjNERbW7G8/65ictSxCox62gNgTOsJ4YXmbwXzBzyyekStzrupg2qNGEkA==}
|
||||
peerDependencies:
|
||||
'@better-auth/utils': 0.4.2
|
||||
'@better-fetch/fetch': 1.3.1
|
||||
'@cloudflare/workers-types': '>=4'
|
||||
'@opentelemetry/api': ^1.9.0
|
||||
better-call: 1.3.7
|
||||
jose: ^6.1.0
|
||||
kysely: ^0.28.5 || ^0.29.0
|
||||
nanostores: ^1.0.1
|
||||
peerDependenciesMeta:
|
||||
'@cloudflare/workers-types':
|
||||
optional: true
|
||||
'@opentelemetry/api':
|
||||
optional: true
|
||||
|
||||
'@better-auth/drizzle-adapter@1.6.26':
|
||||
resolution: {integrity: sha512-SMvAeeUqEsz0BLtWVVp+HdStAVOwcxs4vPkL/AVmFJ0e9dDKItXl881xWeB/Ze4NgBW6NYmUId9qI4LrdQu3hA==}
|
||||
peerDependencies:
|
||||
'@better-auth/core': ^1.6.26
|
||||
'@better-auth/utils': 0.4.2
|
||||
drizzle-orm: ^0.45.2
|
||||
peerDependenciesMeta:
|
||||
drizzle-orm:
|
||||
optional: true
|
||||
|
||||
'@better-auth/kysely-adapter@1.6.26':
|
||||
resolution: {integrity: sha512-Y0Kdqn8JQMR8dHMtUnbBNqq7Mk8mDf18DwTves2uhjtRfcOWByVTGxsFMDVUbedMuoM+Ab+v04bwCk94sAo8NA==}
|
||||
peerDependencies:
|
||||
'@better-auth/core': ^1.6.26
|
||||
'@better-auth/utils': 0.4.2
|
||||
kysely: ^0.28.17 || ^0.29.0
|
||||
peerDependenciesMeta:
|
||||
kysely:
|
||||
optional: true
|
||||
|
||||
'@better-auth/memory-adapter@1.6.26':
|
||||
resolution: {integrity: sha512-kb5ahphEp9jyMleXU4T8I/xgWPa8gjOLFKKsnaVqR/BU+h7xqTOsjJwTY3evY+PFYHvjNFUlrjZ1Km8A/w1p/w==}
|
||||
peerDependencies:
|
||||
'@better-auth/core': ^1.6.26
|
||||
'@better-auth/utils': 0.4.2
|
||||
|
||||
'@better-auth/mongo-adapter@1.6.26':
|
||||
resolution: {integrity: sha512-jYGhuIQqj48h69ROLPYdc8jgqDaMmRRLLFiRViZFYarNyBuYUV07DywJXvRuw8l9ADx+M1TB+BJZGnLE2nnmwQ==}
|
||||
peerDependencies:
|
||||
'@better-auth/core': ^1.6.26
|
||||
'@better-auth/utils': 0.4.2
|
||||
mongodb: ^6.0.0 || ^7.0.0
|
||||
peerDependenciesMeta:
|
||||
mongodb:
|
||||
optional: true
|
||||
|
||||
'@better-auth/prisma-adapter@1.6.26':
|
||||
resolution: {integrity: sha512-ILQoYmnoYyghDP4iN1h/Gkd9Jt7Xs/vxoNAt4AuuJJbqs73u27LlQM4P1YiP7nJ+bM1iVTBI1dDF73myIAtjzQ==}
|
||||
peerDependencies:
|
||||
'@better-auth/core': ^1.6.26
|
||||
'@better-auth/utils': 0.4.2
|
||||
'@prisma/client': ^5.0.0 || ^6.0.0 || ^7.0.0
|
||||
prisma: ^5.0.0 || ^6.0.0 || ^7.0.0
|
||||
peerDependenciesMeta:
|
||||
'@prisma/client':
|
||||
optional: true
|
||||
prisma:
|
||||
optional: true
|
||||
|
||||
'@better-auth/telemetry@1.6.26':
|
||||
resolution: {integrity: sha512-pBs69RORUSJHRF9r5PdeY7pzLRga09YSWew8igFYrBvT2tLt7DktrbD5WjryLZpAZOuKAMZ+Xo0DlJbnvLWGpQ==}
|
||||
peerDependencies:
|
||||
'@better-auth/core': ^1.6.26
|
||||
'@better-auth/utils': 0.4.2
|
||||
'@better-fetch/fetch': 1.3.1
|
||||
|
||||
'@better-auth/utils@0.4.2':
|
||||
resolution: {integrity: sha512-AUxrvu+HaaODsUyzDxFgwd/8RZ1yZaYo42LXKSrU2oGgR38pS1ij8nqQKNgtTWoYGpNevNXtCfgTy6loHveW9A==}
|
||||
|
||||
'@better-auth/utils@0.4.3':
|
||||
resolution: {integrity: sha512-/X4gRYJBwRuLFjjANVpTDJJkAhLD6Sf8SIBypQ+Q2kDW1MnCsyxUujJzdKYsp59i4c41+AaMtpY/WQAQumqtOA==}
|
||||
|
||||
'@better-fetch/fetch@1.3.1':
|
||||
resolution: {integrity: sha512-ABkD1WhyfPZprKRQI3bhATjeiFuNWC9PXhfGWqL+sg/gKrM977oFrYkdb4msM3hgUGonr7KlOsOFT5TU2rht9g==}
|
||||
|
||||
'@bramus/specificity@2.4.2':
|
||||
resolution: {integrity: sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==}
|
||||
hasBin: true
|
||||
@@ -1020,6 +1114,14 @@ packages:
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@noble/ciphers@2.3.0':
|
||||
resolution: {integrity: sha512-Clu/xdfgVTf9o7ngLOURaxePwR0j8sjclKEtVij10/jGulwFsPWCvvRgG/XjUVf8Nei+jLG6uwyXzUTGY1DQrw==}
|
||||
engines: {node: '>= 20.19.0'}
|
||||
|
||||
'@noble/hashes@2.3.0':
|
||||
resolution: {integrity: sha512-oN+QwyX7VSHotibwubG3kpzbwKrfnyR6OOO+3Nk/53ADL7FmgHHz4TgrbaYKvvOw09u6QTx0oiH1cNCIOuN0CQ==}
|
||||
engines: {node: '>= 20.19.0'}
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
|
||||
engines: {node: '>= 8'}
|
||||
@@ -1036,6 +1138,10 @@ packages:
|
||||
resolution: {integrity: sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==}
|
||||
engines: {node: '>=12.4.0'}
|
||||
|
||||
'@opentelemetry/semantic-conventions@1.43.0':
|
||||
resolution: {integrity: sha512-eSYWTm620tTk45EKSedaUL8MFYI8hW164hIXsgIHyxu3VobUB3fFCu5t0hQby6OoWRPsG1KkKUG2M5UadiLiVg==}
|
||||
engines: {node: '>=14'}
|
||||
|
||||
'@oxc-project/types@0.143.0':
|
||||
resolution: {integrity: sha512-u6JZdLBTLotrNC9Vd6vPssINdzcCzleKAH6EJKImQb7GtYvX5keN2dxkoK44stCc4tffE6QQRtZTXVSzsLUlWA==}
|
||||
|
||||
@@ -1325,6 +1431,9 @@ packages:
|
||||
'@types/node@24.13.3':
|
||||
resolution: {integrity: sha512-Dh8vAsV36ig5wa9OX4pXvMc9D3Veibfw2wix0CUwYODLD8nkj9UsLjASr49nPg+2eKzxhBV+v7L8pXvT4e639Q==}
|
||||
|
||||
'@types/nodemailer@8.0.1':
|
||||
resolution: {integrity: sha512-PxpaInm8V1JQDd4j0ds5HfvWQk8JupS1C0Picb96QJsrrRDjBH+DlK7L4ZdNSqNULhiZRQHc40nLVShaGxXAMw==}
|
||||
|
||||
'@types/pg@8.21.0':
|
||||
resolution: {integrity: sha512-AYdtudzabjLZgVgRZmAnU8bAnVUXzuJX2IYHeSIiIHm68olD+LgQYCGWdtcNYnP0uq9c4S4NibVG3Ni7VbKW7Q==}
|
||||
|
||||
@@ -1748,6 +1857,76 @@ packages:
|
||||
bcrypt-pbkdf@1.0.2:
|
||||
resolution: {integrity: sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==}
|
||||
|
||||
better-auth@1.6.26:
|
||||
resolution: {integrity: sha512-nhXWrDDj+EnZsHq1j0z1c6DowOMFZWZHe6LCaXbBfLIgHHZm6dyazBQcbRspM4spUIcUt250Mc1BFOSuP7eniQ==}
|
||||
peerDependencies:
|
||||
'@lynx-js/react': '*'
|
||||
'@prisma/client': ^5.0.0 || ^6.0.0 || ^7.0.0
|
||||
'@sveltejs/kit': ^2.0.0
|
||||
'@tanstack/react-start': ^1.0.0
|
||||
'@tanstack/solid-start': ^1.0.0
|
||||
better-sqlite3: ^12.0.0
|
||||
drizzle-kit: '>=0.31.4'
|
||||
drizzle-orm: ^0.45.2
|
||||
mongodb: ^6.0.0 || ^7.0.0
|
||||
mysql2: ^3.0.0
|
||||
next: ^14.0.0 || ^15.0.0 || ^16.0.0
|
||||
pg: ^8.0.0
|
||||
prisma: ^5.0.0 || ^6.0.0 || ^7.0.0
|
||||
react: ^18.0.0 || ^19.0.0
|
||||
react-dom: ^18.0.0 || ^19.0.0
|
||||
solid-js: ^1.0.0
|
||||
svelte: ^4.0.0 || ^5.0.0
|
||||
vitest: ^2.0.0 || ^3.0.0 || ^4.0.0
|
||||
vue: ^3.0.0
|
||||
peerDependenciesMeta:
|
||||
'@lynx-js/react':
|
||||
optional: true
|
||||
'@prisma/client':
|
||||
optional: true
|
||||
'@sveltejs/kit':
|
||||
optional: true
|
||||
'@tanstack/react-start':
|
||||
optional: true
|
||||
'@tanstack/solid-start':
|
||||
optional: true
|
||||
better-sqlite3:
|
||||
optional: true
|
||||
drizzle-kit:
|
||||
optional: true
|
||||
drizzle-orm:
|
||||
optional: true
|
||||
mongodb:
|
||||
optional: true
|
||||
mysql2:
|
||||
optional: true
|
||||
next:
|
||||
optional: true
|
||||
pg:
|
||||
optional: true
|
||||
prisma:
|
||||
optional: true
|
||||
react:
|
||||
optional: true
|
||||
react-dom:
|
||||
optional: true
|
||||
solid-js:
|
||||
optional: true
|
||||
svelte:
|
||||
optional: true
|
||||
vitest:
|
||||
optional: true
|
||||
vue:
|
||||
optional: true
|
||||
|
||||
better-call@1.3.7:
|
||||
resolution: {integrity: sha512-Al51/hjp2SSp6CRTa3F2ptcx4yQVS1xWKoY6jcVXqNYOap6mHFP2jUBn5EwIL4iIed1/Sq4hlQ+Umm6EflZG+w==}
|
||||
peerDependencies:
|
||||
zod: ^4.0.0
|
||||
peerDependenciesMeta:
|
||||
zod:
|
||||
optional: true
|
||||
|
||||
bidi-js@1.0.3:
|
||||
resolution: {integrity: sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==}
|
||||
|
||||
@@ -1928,6 +2107,9 @@ packages:
|
||||
resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
||||
defu@6.1.7:
|
||||
resolution: {integrity: sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==}
|
||||
|
||||
dequal@2.0.3:
|
||||
resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
|
||||
engines: {node: '>=6'}
|
||||
@@ -2622,6 +2804,9 @@ packages:
|
||||
resolution: {integrity: sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==}
|
||||
hasBin: true
|
||||
|
||||
jose@6.2.8:
|
||||
resolution: {integrity: sha512-Bsdjwm3Qsd/P0jR+BHDe3LytDfY7WBq2HmCCLIwuVRHMuEC9ae7/R474GIUdF1NgCyZjzVo/A9DOiOBtXq8ZoQ==}
|
||||
|
||||
js-tokens@4.0.0:
|
||||
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
||||
|
||||
@@ -2668,6 +2853,10 @@ packages:
|
||||
keyv@4.5.4:
|
||||
resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==}
|
||||
|
||||
kysely@0.29.4:
|
||||
resolution: {integrity: sha512-y5mVgQNkMbs1eK9Xyc0pmNdabN2wHhRYY/5r4W5HrUT1rYCEPeVNSj1RUJeSDKT3U0p+mXCvLgkrFuIafYI6BA==}
|
||||
engines: {node: '>=22.0.0'}
|
||||
|
||||
language-subtag-registry@0.3.23:
|
||||
resolution: {integrity: sha512-0K65Lea881pHotoGEa5gDlMxt3pctLi2RplBb7Ezh4rRdLEOtgi7n4EwK9lamnUCkKBqaeKRVebTq6BAxSkpXQ==}
|
||||
|
||||
@@ -2928,6 +3117,10 @@ packages:
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
hasBin: true
|
||||
|
||||
nanostores@1.4.2:
|
||||
resolution: {integrity: sha512-Wxv8Roefr2nqtiRG0bnaFlpYqpIVtOEeJZHaH+4nGgOK1/7n6OHOuHCb/bhqrNQgZM8fyd0s1PqhdrJc9Ib44g==}
|
||||
engines: {node: ^20.0.0 || >=22.0.0}
|
||||
|
||||
napi-postinstall@0.3.4:
|
||||
resolution: {integrity: sha512-PHI5f1O0EP5xJ9gQmFGMS6IZcrVvTjpXjz7Na41gTE7eE2hK11lg04CECCYEEjdc17EV4DO+fkGEtt7TpTaTiQ==}
|
||||
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
|
||||
@@ -2965,6 +3158,10 @@ packages:
|
||||
resolution: {integrity: sha512-D9UOmYG3UH1V+ENW56t5QXBwJw1YEY18ruVeus89Rw+SyIgjPkCO84bRzO3uNIYosJbNwiabWVn48o3uJLjxFQ==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
nodemailer@9.0.5:
|
||||
resolution: {integrity: sha512-wvjiKvjczmsN7U/8006JOdXubgBk2XFAbioDMbT+sM7cPs0QrhJTa6KBRX7P5REGGkDcLUz/EarWidb8G8C1jQ==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
|
||||
normalize-path@3.0.0:
|
||||
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@@ -3238,6 +3435,9 @@ packages:
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
hasBin: true
|
||||
|
||||
rou3@0.7.12:
|
||||
resolution: {integrity: sha512-iFE4hLDuloSWcD7mjdCDhx2bKcIsYbtOTpfH5MHHLSKMOUyjqQXTeZVa289uuwEGEKFoE/BAPbhaU4B774nceg==}
|
||||
|
||||
run-parallel@1.2.0:
|
||||
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
|
||||
|
||||
@@ -3281,6 +3481,9 @@ packages:
|
||||
server-only@0.0.1:
|
||||
resolution: {integrity: sha512-qepMx2JxAa5jjfzxG79yPPq+8BuFToHd1hm7kI+Z4zAq1ftQiP7HcxMhDDItrbtwVeLg/cY2JnKnrcFkmiswNA==}
|
||||
|
||||
set-cookie-parser@3.1.2:
|
||||
resolution: {integrity: sha512-5/r/lTwbJ3zQ+qwdUFZYeRNqda7P5HD8zQKqlSjdGt1/S0cjLAphHusj4Y58ahDtWn/g32xrIS58/ikOvwl0Lw==}
|
||||
|
||||
set-function-length@1.2.2:
|
||||
resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@@ -3925,6 +4128,63 @@ snapshots:
|
||||
|
||||
'@balena/dockerignore@1.0.2': {}
|
||||
|
||||
'@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2)':
|
||||
dependencies:
|
||||
'@better-auth/utils': 0.4.2
|
||||
'@better-fetch/fetch': 1.3.1
|
||||
'@opentelemetry/semantic-conventions': 1.43.0
|
||||
'@standard-schema/spec': 1.1.0
|
||||
better-call: 1.3.7(zod@4.4.3)
|
||||
jose: 6.2.8
|
||||
kysely: 0.29.4
|
||||
nanostores: 1.4.2
|
||||
zod: 4.4.3
|
||||
|
||||
'@better-auth/drizzle-adapter@1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)(drizzle-orm@0.45.2(@types/pg@8.21.0)(kysely@0.29.4)(pg@8.22.0))':
|
||||
dependencies:
|
||||
'@better-auth/core': 1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2)
|
||||
'@better-auth/utils': 0.4.2
|
||||
optionalDependencies:
|
||||
drizzle-orm: 0.45.2(@types/pg@8.21.0)(kysely@0.29.4)(pg@8.22.0)
|
||||
|
||||
'@better-auth/kysely-adapter@1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)(kysely@0.29.4)':
|
||||
dependencies:
|
||||
'@better-auth/core': 1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2)
|
||||
'@better-auth/utils': 0.4.2
|
||||
optionalDependencies:
|
||||
kysely: 0.29.4
|
||||
|
||||
'@better-auth/memory-adapter@1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)':
|
||||
dependencies:
|
||||
'@better-auth/core': 1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2)
|
||||
'@better-auth/utils': 0.4.2
|
||||
|
||||
'@better-auth/mongo-adapter@1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)':
|
||||
dependencies:
|
||||
'@better-auth/core': 1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2)
|
||||
'@better-auth/utils': 0.4.2
|
||||
|
||||
'@better-auth/prisma-adapter@1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)':
|
||||
dependencies:
|
||||
'@better-auth/core': 1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2)
|
||||
'@better-auth/utils': 0.4.2
|
||||
|
||||
'@better-auth/telemetry@1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)':
|
||||
dependencies:
|
||||
'@better-auth/core': 1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2)
|
||||
'@better-auth/utils': 0.4.2
|
||||
'@better-fetch/fetch': 1.3.1
|
||||
|
||||
'@better-auth/utils@0.4.2':
|
||||
dependencies:
|
||||
'@noble/hashes': 2.3.0
|
||||
|
||||
'@better-auth/utils@0.4.3':
|
||||
dependencies:
|
||||
'@noble/hashes': 2.3.0
|
||||
|
||||
'@better-fetch/fetch@1.3.1': {}
|
||||
|
||||
'@bramus/specificity@2.4.2':
|
||||
dependencies:
|
||||
css-tree: 3.2.1
|
||||
@@ -4259,7 +4519,9 @@ snapshots:
|
||||
'@eslint/core': 0.17.0
|
||||
levn: 0.4.1
|
||||
|
||||
'@exodus/bytes@1.15.1': {}
|
||||
'@exodus/bytes@1.15.1(@noble/hashes@2.3.0)':
|
||||
optionalDependencies:
|
||||
'@noble/hashes': 2.3.0
|
||||
|
||||
'@grpc/grpc-js@1.14.4':
|
||||
dependencies:
|
||||
@@ -4479,6 +4741,10 @@ snapshots:
|
||||
'@next/swc-win32-x64-msvc@16.3.0':
|
||||
optional: true
|
||||
|
||||
'@noble/ciphers@2.3.0': {}
|
||||
|
||||
'@noble/hashes@2.3.0': {}
|
||||
|
||||
'@nodelib/fs.scandir@2.1.5':
|
||||
dependencies:
|
||||
'@nodelib/fs.stat': 2.0.5
|
||||
@@ -4493,6 +4759,8 @@ snapshots:
|
||||
|
||||
'@nolyfill/is-core-module@1.0.39': {}
|
||||
|
||||
'@opentelemetry/semantic-conventions@1.43.0': {}
|
||||
|
||||
'@oxc-project/types@0.143.0': {}
|
||||
|
||||
'@pkgjs/parseargs@0.11.0':
|
||||
@@ -4718,6 +4986,10 @@ snapshots:
|
||||
dependencies:
|
||||
undici-types: 7.18.2
|
||||
|
||||
'@types/nodemailer@8.0.1':
|
||||
dependencies:
|
||||
'@types/node': 24.13.3
|
||||
|
||||
'@types/pg@8.21.0':
|
||||
dependencies:
|
||||
'@types/node': 24.13.3
|
||||
@@ -5145,6 +5417,46 @@ snapshots:
|
||||
dependencies:
|
||||
tweetnacl: 0.14.5
|
||||
|
||||
better-auth@1.6.26(drizzle-kit@0.31.10)(drizzle-orm@0.45.2(@types/pg@8.21.0)(kysely@0.29.4)(pg@8.22.0))(next@16.3.0(@babel/core@7.29.7(supports-color@7.2.0))(@types/node@24.13.3)(react-dom@19.2.8(react@19.2.8))(react@19.2.8))(pg@8.22.0)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(vitest@4.1.10(@types/node@24.13.3)(jsdom@30.0.1(@noble/hashes@2.3.0))(vite@8.2.1(@types/node@24.13.3)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.23.11)(yaml@2.9.0))):
|
||||
dependencies:
|
||||
'@better-auth/core': 1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2)
|
||||
'@better-auth/drizzle-adapter': 1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)(drizzle-orm@0.45.2(@types/pg@8.21.0)(kysely@0.29.4)(pg@8.22.0))
|
||||
'@better-auth/kysely-adapter': 1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)(kysely@0.29.4)
|
||||
'@better-auth/memory-adapter': 1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)
|
||||
'@better-auth/mongo-adapter': 1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)
|
||||
'@better-auth/prisma-adapter': 1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)
|
||||
'@better-auth/telemetry': 1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)
|
||||
'@better-auth/utils': 0.4.2
|
||||
'@better-fetch/fetch': 1.3.1
|
||||
'@noble/ciphers': 2.3.0
|
||||
'@noble/hashes': 2.3.0
|
||||
better-call: 1.3.7(zod@4.4.3)
|
||||
defu: 6.1.7
|
||||
jose: 6.2.8
|
||||
kysely: 0.29.4
|
||||
nanostores: 1.4.2
|
||||
zod: 4.4.3
|
||||
optionalDependencies:
|
||||
drizzle-kit: 0.31.10
|
||||
drizzle-orm: 0.45.2(@types/pg@8.21.0)(kysely@0.29.4)(pg@8.22.0)
|
||||
next: 16.3.0(@babel/core@7.29.7(supports-color@7.2.0))(@types/node@24.13.3)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)
|
||||
pg: 8.22.0
|
||||
react: 19.2.8
|
||||
react-dom: 19.2.8(react@19.2.8)
|
||||
vitest: 4.1.10(@types/node@24.13.3)(jsdom@30.0.1(@noble/hashes@2.3.0))(vite@8.2.1(@types/node@24.13.3)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.23.11)(yaml@2.9.0))
|
||||
transitivePeerDependencies:
|
||||
- '@cloudflare/workers-types'
|
||||
- '@opentelemetry/api'
|
||||
|
||||
better-call@1.3.7(zod@4.4.3):
|
||||
dependencies:
|
||||
'@better-auth/utils': 0.4.3
|
||||
'@better-fetch/fetch': 1.3.1
|
||||
rou3: 0.7.12
|
||||
set-cookie-parser: 3.1.2
|
||||
optionalDependencies:
|
||||
zod: 4.4.3
|
||||
|
||||
bidi-js@1.0.3:
|
||||
dependencies:
|
||||
require-from-string: 2.0.2
|
||||
@@ -5287,10 +5599,10 @@ snapshots:
|
||||
|
||||
damerau-levenshtein@1.0.8: {}
|
||||
|
||||
data-urls@7.0.0:
|
||||
data-urls@7.0.0(@noble/hashes@2.3.0):
|
||||
dependencies:
|
||||
whatwg-mimetype: 5.0.0
|
||||
whatwg-url: 16.0.1
|
||||
whatwg-url: 16.0.1(@noble/hashes@2.3.0)
|
||||
transitivePeerDependencies:
|
||||
- '@noble/hashes'
|
||||
|
||||
@@ -5340,6 +5652,8 @@ snapshots:
|
||||
has-property-descriptors: 1.0.2
|
||||
object-keys: 1.1.1
|
||||
|
||||
defu@6.1.7: {}
|
||||
|
||||
dequal@2.0.3: {}
|
||||
|
||||
detect-libc@2.1.2: {}
|
||||
@@ -5383,9 +5697,10 @@ snapshots:
|
||||
esbuild: 0.25.12
|
||||
tsx: 4.23.11
|
||||
|
||||
drizzle-orm@0.45.2(@types/pg@8.21.0)(pg@8.22.0):
|
||||
drizzle-orm@0.45.2(@types/pg@8.21.0)(kysely@0.29.4)(pg@8.22.0):
|
||||
optionalDependencies:
|
||||
'@types/pg': 8.21.0
|
||||
kysely: 0.29.4
|
||||
pg: 8.22.0
|
||||
|
||||
dunder-proto@1.0.1:
|
||||
@@ -6002,9 +6317,9 @@ snapshots:
|
||||
dependencies:
|
||||
hermes-estree: 0.25.1
|
||||
|
||||
html-encoding-sniffer@6.0.0:
|
||||
html-encoding-sniffer@6.0.0(@noble/hashes@2.3.0):
|
||||
dependencies:
|
||||
'@exodus/bytes': 1.15.1
|
||||
'@exodus/bytes': 1.15.1(@noble/hashes@2.3.0)
|
||||
transitivePeerDependencies:
|
||||
- '@noble/hashes'
|
||||
|
||||
@@ -6176,23 +6491,25 @@ snapshots:
|
||||
|
||||
jiti@2.7.0: {}
|
||||
|
||||
jose@6.2.8: {}
|
||||
|
||||
js-tokens@4.0.0: {}
|
||||
|
||||
js-yaml@4.3.1:
|
||||
dependencies:
|
||||
argparse: 2.0.1
|
||||
|
||||
jsdom@30.0.1:
|
||||
jsdom@30.0.1(@noble/hashes@2.3.0):
|
||||
dependencies:
|
||||
'@asamuzakjp/css-color': 6.0.5
|
||||
'@asamuzakjp/dom-selector': 8.3.2
|
||||
'@bramus/specificity': 2.4.2
|
||||
'@csstools/css-syntax-patches-for-csstree': 1.1.7(css-tree@3.2.1)
|
||||
'@exodus/bytes': 1.15.1
|
||||
'@exodus/bytes': 1.15.1(@noble/hashes@2.3.0)
|
||||
css-tree: 3.2.1
|
||||
data-urls: 7.0.0
|
||||
data-urls: 7.0.0(@noble/hashes@2.3.0)
|
||||
decimal.js: 10.6.0
|
||||
html-encoding-sniffer: 6.0.0
|
||||
html-encoding-sniffer: 6.0.0(@noble/hashes@2.3.0)
|
||||
is-potential-custom-element-name: 1.0.1
|
||||
lru-cache: 11.5.2
|
||||
parse5: 8.0.1
|
||||
@@ -6203,7 +6520,7 @@ snapshots:
|
||||
w3c-xmlserializer: 5.0.0
|
||||
webidl-conversions: 8.0.1
|
||||
whatwg-mimetype: 5.0.0
|
||||
whatwg-url: 17.1.0
|
||||
whatwg-url: 17.1.0(@noble/hashes@2.3.0)
|
||||
xml-name-validator: 5.0.0
|
||||
transitivePeerDependencies:
|
||||
- '@noble/hashes'
|
||||
@@ -6233,6 +6550,8 @@ snapshots:
|
||||
dependencies:
|
||||
json-buffer: 3.0.1
|
||||
|
||||
kysely@0.29.4: {}
|
||||
|
||||
language-subtag-registry@0.3.23: {}
|
||||
|
||||
language-tags@1.0.9:
|
||||
@@ -6420,6 +6739,8 @@ snapshots:
|
||||
|
||||
nanoid@3.3.18: {}
|
||||
|
||||
nanostores@1.4.2: {}
|
||||
|
||||
napi-postinstall@0.3.4: {}
|
||||
|
||||
natural-compare@1.4.0: {}
|
||||
@@ -6458,6 +6779,8 @@ snapshots:
|
||||
|
||||
node-releases@2.0.53: {}
|
||||
|
||||
nodemailer@9.0.5: {}
|
||||
|
||||
normalize-path@3.0.0: {}
|
||||
|
||||
object-assign@4.1.1: {}
|
||||
@@ -6779,6 +7102,8 @@ snapshots:
|
||||
'@rolldown/binding-win32-arm64-msvc': 1.2.3
|
||||
'@rolldown/binding-win32-x64-msvc': 1.2.3
|
||||
|
||||
rou3@0.7.12: {}
|
||||
|
||||
run-parallel@1.2.0:
|
||||
dependencies:
|
||||
queue-microtask: 1.2.3
|
||||
@@ -6820,6 +7145,8 @@ snapshots:
|
||||
|
||||
server-only@0.0.1: {}
|
||||
|
||||
set-cookie-parser@3.1.2: {}
|
||||
|
||||
set-function-length@1.2.2:
|
||||
dependencies:
|
||||
define-data-property: 1.1.4
|
||||
@@ -7311,7 +7638,7 @@ snapshots:
|
||||
tsx: 4.23.11
|
||||
yaml: 2.9.0
|
||||
|
||||
vitest@4.1.10(@types/node@24.13.3)(jsdom@30.0.1)(vite@8.2.1(@types/node@24.13.3)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.23.11)(yaml@2.9.0)):
|
||||
vitest@4.1.10(@types/node@24.13.3)(jsdom@30.0.1(@noble/hashes@2.3.0))(vite@8.2.1(@types/node@24.13.3)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.23.11)(yaml@2.9.0)):
|
||||
dependencies:
|
||||
'@vitest/expect': 4.1.10
|
||||
'@vitest/mocker': 4.1.10(vite@8.2.1(@types/node@24.13.3)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.23.11)(yaml@2.9.0))
|
||||
@@ -7335,7 +7662,7 @@ snapshots:
|
||||
why-is-node-running: 2.3.0
|
||||
optionalDependencies:
|
||||
'@types/node': 24.13.3
|
||||
jsdom: 30.0.1
|
||||
jsdom: 30.0.1(@noble/hashes@2.3.0)
|
||||
transitivePeerDependencies:
|
||||
- msw
|
||||
|
||||
@@ -7347,17 +7674,17 @@ snapshots:
|
||||
|
||||
whatwg-mimetype@5.0.0: {}
|
||||
|
||||
whatwg-url@16.0.1:
|
||||
whatwg-url@16.0.1(@noble/hashes@2.3.0):
|
||||
dependencies:
|
||||
'@exodus/bytes': 1.15.1
|
||||
'@exodus/bytes': 1.15.1(@noble/hashes@2.3.0)
|
||||
tr46: 6.0.0
|
||||
webidl-conversions: 8.0.1
|
||||
transitivePeerDependencies:
|
||||
- '@noble/hashes'
|
||||
|
||||
whatwg-url@17.1.0:
|
||||
whatwg-url@17.1.0(@noble/hashes@2.3.0):
|
||||
dependencies:
|
||||
'@exodus/bytes': 1.15.1
|
||||
'@exodus/bytes': 1.15.1(@noble/hashes@2.3.0)
|
||||
tr46: 6.0.0
|
||||
webidl-conversions: 8.0.1
|
||||
transitivePeerDependencies:
|
||||
|
||||
@@ -1,2 +1,6 @@
|
||||
allowBuilds:
|
||||
cpu-features: false
|
||||
esbuild: true
|
||||
protobufjs: false
|
||||
ssh2: false
|
||||
unrs-resolver: true
|
||||
@@ -0,0 +1,38 @@
|
||||
import Link from "next/link";
|
||||
|
||||
import { env } from "@/config/env";
|
||||
import { LoginForm } from "@/modules/auth/public-forms";
|
||||
|
||||
export default function LoginPage() {
|
||||
return (
|
||||
<main className="public-account-page">
|
||||
<header className="masthead">
|
||||
<Link className="wordmark" href="/">
|
||||
Leon Tonhäuser
|
||||
</Link>
|
||||
<span className="section-label">Redaktionsportal</span>
|
||||
</header>
|
||||
<section className="account-panel" aria-labelledby="login-title">
|
||||
<p className="eyebrow">Zugang</p>
|
||||
<h1 id="login-title">Anmelden</h1>
|
||||
<p className="lede">Melden Sie sich mit der E-Mail-Adresse Ihrer Redaktion an.</p>
|
||||
<LoginForm />
|
||||
<nav className="account-links" aria-label="Zugang verwalten">
|
||||
<Link href="/passwort-vergessen">Passwort vergessen?</Link>
|
||||
<Link href="/registrieren">Neue Redaktion registrieren</Link>
|
||||
</nav>
|
||||
</section>
|
||||
<LegalFooter imprint={env.LEGAL_IMPRINT_URL} privacy={env.LEGAL_PRIVACY_URL} terms={env.LEGAL_TERMS_URL} />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
function LegalFooter({ imprint, privacy, terms }: { imprint: string; privacy: string; terms: string }) {
|
||||
return (
|
||||
<footer className="public-footer">
|
||||
<a href={imprint}>Impressum</a>
|
||||
<a href={privacy}>Datenschutz</a>
|
||||
<a href={terms}>Nutzungsbedingungen</a>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import Link from "next/link";
|
||||
|
||||
import { PasswordResetRequestForm } from "@/modules/auth/public-forms";
|
||||
|
||||
export default function ForgotPasswordPage() {
|
||||
return (
|
||||
<main className="public-account-page">
|
||||
<header className="masthead">
|
||||
<Link className="wordmark" href="/">
|
||||
Leon Tonhäuser
|
||||
</Link>
|
||||
<span className="section-label">Redaktionsportal</span>
|
||||
</header>
|
||||
<section className="account-panel" aria-labelledby="forgot-password-title">
|
||||
<p className="eyebrow">Zugang</p>
|
||||
<h1 id="forgot-password-title">Passwort vergessen?</h1>
|
||||
<p className="lede">Fordern Sie einen Link zum Zurücksetzen Ihres Passworts an.</p>
|
||||
<PasswordResetRequestForm />
|
||||
<nav className="account-links" aria-label="Zurück zur Anmeldung">
|
||||
<Link href="/anmelden">Zur Anmeldung</Link>
|
||||
</nav>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import Link from "next/link";
|
||||
|
||||
import { PasswordResetForm } from "@/modules/auth/public-forms";
|
||||
|
||||
export default async function ResetPasswordPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ token?: string }>;
|
||||
}) {
|
||||
const { token } = await searchParams;
|
||||
|
||||
return (
|
||||
<main className="public-account-page">
|
||||
<header className="masthead">
|
||||
<Link className="wordmark" href="/">
|
||||
Leon Tonhäuser
|
||||
</Link>
|
||||
<span className="section-label">Redaktionsportal</span>
|
||||
</header>
|
||||
<section className="account-panel" aria-labelledby="reset-password-title">
|
||||
<p className="eyebrow">Zugang</p>
|
||||
<h1 id="reset-password-title">Neues Passwort setzen</h1>
|
||||
<p className="lede">Wählen Sie ein neues Passwort für den Zugang Ihrer Redaktion.</p>
|
||||
<PasswordResetForm token={token} />
|
||||
<nav className="account-links" aria-label="Zurück zur Anmeldung">
|
||||
<Link href="/anmelden">Zur Anmeldung</Link>
|
||||
</nav>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import Link from "next/link";
|
||||
|
||||
export default function RegistrationConfirmedPage() {
|
||||
return (
|
||||
<main className="public-account-page">
|
||||
<header className="masthead">
|
||||
<Link className="wordmark" href="/">
|
||||
Leon Tonhäuser
|
||||
</Link>
|
||||
<span className="section-label">Redaktionsportal</span>
|
||||
</header>
|
||||
<section className="account-panel" aria-labelledby="confirmation-title">
|
||||
<p className="eyebrow">Registrierung</p>
|
||||
<h1 id="confirmation-title">Vielen Dank.</h1>
|
||||
<p className="lede">
|
||||
Bitte folgen Sie den weiteren Hinweisen, die wir Ihnen gegebenenfalls zusenden. Danach
|
||||
prüfen wir Ihre Registrierung.
|
||||
</p>
|
||||
<Link className="primary-action" href="/anmelden">
|
||||
Zur Anmeldung
|
||||
</Link>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
import Link from "next/link";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { env } from "@/config/env";
|
||||
import { registerEditorial } from "@/modules/auth/auth";
|
||||
import { RegistrationValidationError } from "@/modules/auth/registration";
|
||||
import {
|
||||
RegistrationForm,
|
||||
type RegistrationFormState,
|
||||
} from "@/modules/auth/public-forms";
|
||||
|
||||
export default function RegistrationPage() {
|
||||
return (
|
||||
<main className="public-account-page">
|
||||
<header className="masthead">
|
||||
<Link className="wordmark" href="/">
|
||||
Leon Tonhäuser
|
||||
</Link>
|
||||
<span className="section-label">Redaktionsportal</span>
|
||||
</header>
|
||||
<section className="account-panel account-panel-wide" aria-labelledby="registration-title">
|
||||
<p className="eyebrow">B2B-Zugang</p>
|
||||
<h1 id="registration-title">Redaktion registrieren</h1>
|
||||
<p className="lede">
|
||||
Das Redaktionsportal steht ausschließlich Unternehmen und Redaktionen zur Verfügung.
|
||||
</p>
|
||||
<RegistrationForm
|
||||
action={registerAction}
|
||||
legalUrls={{
|
||||
imprint: env.LEGAL_IMPRINT_URL,
|
||||
privacy: env.LEGAL_PRIVACY_URL,
|
||||
terms: env.LEGAL_TERMS_URL,
|
||||
}}
|
||||
/>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
async function registerAction(
|
||||
_state: RegistrationFormState,
|
||||
formData: FormData,
|
||||
): Promise<RegistrationFormState> {
|
||||
"use server";
|
||||
|
||||
try {
|
||||
await registerEditorial({
|
||||
companyName: text(formData, "companyName"),
|
||||
contactName: text(formData, "contactName"),
|
||||
email: text(formData, "email"),
|
||||
password: text(formData, "password"),
|
||||
billingAddress: {
|
||||
addressLine1: text(formData, "addressLine1"),
|
||||
addressLine2: text(formData, "addressLine2") || undefined,
|
||||
postalCode: text(formData, "postalCode"),
|
||||
city: text(formData, "city"),
|
||||
countryCode: text(formData, "countryCode"),
|
||||
},
|
||||
actsForBusiness: formData.has("actsForBusiness"),
|
||||
termsVersion: formData.has("termsAccepted") ? text(formData, "termsVersion") : "",
|
||||
privacyAcknowledged: formData.has("privacyAcknowledged"),
|
||||
});
|
||||
} catch (error) {
|
||||
if (error instanceof RegistrationValidationError) {
|
||||
return { errors: { [error.field]: error.message } };
|
||||
}
|
||||
}
|
||||
|
||||
redirect("/registrieren/bestaetigt");
|
||||
}
|
||||
|
||||
function text(formData: FormData, name: string): string {
|
||||
const value = formData.get(name);
|
||||
return typeof value === "string" ? value : "";
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { toNextJsHandler } from "better-auth/next-js";
|
||||
|
||||
import { auth } from "@/modules/auth/auth";
|
||||
|
||||
export const { GET, POST } = toNextJsHandler(auth);
|
||||
@@ -138,3 +138,141 @@ a {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
.public-account-page {
|
||||
display: grid;
|
||||
min-height: 100vh;
|
||||
grid-template-rows: auto 1fr auto;
|
||||
padding: clamp(1.25rem, 3vw, 2.75rem);
|
||||
}
|
||||
|
||||
.account-panel {
|
||||
width: min(100%, 37rem);
|
||||
align-self: center;
|
||||
padding-block: clamp(4rem, 10vh, 7rem);
|
||||
}
|
||||
|
||||
.account-panel-wide {
|
||||
width: min(100%, 48rem);
|
||||
}
|
||||
|
||||
.account-panel h1 {
|
||||
max-width: 12ch;
|
||||
margin: 0;
|
||||
font-size: clamp(2.6rem, 6vw, 5.5rem);
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.06em;
|
||||
line-height: 0.92;
|
||||
}
|
||||
|
||||
.account-panel .lede {
|
||||
margin-top: 1.75rem;
|
||||
}
|
||||
|
||||
.account-form {
|
||||
display: grid;
|
||||
gap: 1.25rem;
|
||||
margin-top: 2.5rem;
|
||||
}
|
||||
|
||||
.account-form label,
|
||||
.acknowledgements legend {
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 650;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
.account-form input:not([type="checkbox"]) {
|
||||
width: 100%;
|
||||
min-height: 3.1rem;
|
||||
border: 1px solid var(--ink);
|
||||
border-radius: 0;
|
||||
background: var(--paper);
|
||||
color: var(--ink);
|
||||
font: inherit;
|
||||
font-weight: 400;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.acknowledgements {
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
margin: 0;
|
||||
padding: 1.25rem 0;
|
||||
border: 0;
|
||||
border-top: 1px solid var(--line);
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.acknowledgements legend {
|
||||
padding: 0;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
grid-template-columns: 1rem minmax(0, 1fr);
|
||||
align-items: start;
|
||||
font-weight: 400 !important;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.checkbox-label input {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
margin: 0.12rem 0 0;
|
||||
accent-color: var(--ink);
|
||||
}
|
||||
|
||||
.checkbox-label a,
|
||||
.account-links a,
|
||||
.public-footer a,
|
||||
.legal-link {
|
||||
text-underline-offset: 0.17em;
|
||||
}
|
||||
|
||||
.field-error {
|
||||
margin: -0.25rem 0 0;
|
||||
color: #9d0e0e;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.form-note {
|
||||
max-width: 44rem;
|
||||
margin: 0;
|
||||
color: var(--muted);
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.account-links,
|
||||
.public-footer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem 1.25rem;
|
||||
margin-top: 1rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.public-footer {
|
||||
padding-top: 1rem;
|
||||
border-top: 1px solid var(--line);
|
||||
color: var(--muted);
|
||||
font-size: 0.75rem;
|
||||
letter-spacing: 0.06em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
@media (max-width: 40rem) {
|
||||
.form-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
import "server-only";
|
||||
|
||||
import { eq, sql } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
|
||||
import { users } from "@/db/schema";
|
||||
import type * as schema from "@/db/schema";
|
||||
|
||||
export type AdminBootstrapInput = {
|
||||
email: string;
|
||||
name: string;
|
||||
password: string;
|
||||
};
|
||||
|
||||
export type AdminBootstrapAuth = {
|
||||
signUpEmail(input: { email: string; name: string; password: string }): Promise<{ user: { id: string } }>;
|
||||
sendVerificationEmail(input: { email: string }): Promise<void>;
|
||||
};
|
||||
|
||||
export type AdminBootstrapRepository = {
|
||||
countAdmins(): Promise<number>;
|
||||
findUserByEmail(email: string): Promise<{ id: string } | undefined>;
|
||||
promoteUserToAdmin(userId: string): Promise<void>;
|
||||
};
|
||||
|
||||
export function createAdminBootstrapService({
|
||||
auth,
|
||||
repo,
|
||||
}: {
|
||||
auth: AdminBootstrapAuth;
|
||||
repo: AdminBootstrapRepository;
|
||||
}) {
|
||||
return {
|
||||
async bootstrap(input: AdminBootstrapInput): Promise<{ status: "created" | "already_configured" }> {
|
||||
if ((await repo.countAdmins()) > 0) {
|
||||
return { status: "already_configured" };
|
||||
}
|
||||
|
||||
const email = input.email.trim().toLowerCase();
|
||||
const existingUser = await repo.findUserByEmail(email);
|
||||
const user =
|
||||
existingUser ??
|
||||
(await auth.signUpEmail({
|
||||
email,
|
||||
name: input.name.trim(),
|
||||
password: input.password,
|
||||
})).user;
|
||||
|
||||
await repo.promoteUserToAdmin(user.id);
|
||||
await auth.sendVerificationEmail({ email });
|
||||
return { status: "created" };
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function createAdminBootstrapRepository(database: NodePgDatabase<typeof schema>): AdminBootstrapRepository {
|
||||
return {
|
||||
async countAdmins() {
|
||||
const [result] = await database
|
||||
.select({ count: sql<number>`count(*)::int` })
|
||||
.from(users)
|
||||
.where(eq(users.role, "ADMIN"));
|
||||
return result.count;
|
||||
},
|
||||
async findUserByEmail(email) {
|
||||
const [user] = await database
|
||||
.select({ id: users.id })
|
||||
.from(users)
|
||||
.where(eq(users.email, email))
|
||||
.limit(1);
|
||||
return user;
|
||||
},
|
||||
async promoteUserToAdmin(userId) {
|
||||
await database
|
||||
.update(users)
|
||||
.set({ role: "ADMIN", updatedAt: new Date() })
|
||||
.where(eq(users.id, userId));
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { expect, test } from "vitest";
|
||||
|
||||
import { auth } from "./auth";
|
||||
|
||||
test("rejects direct Better Auth sign-up requests that bypass B2B registration", async () => {
|
||||
const response = await auth.handler(
|
||||
new Request("http://localhost:3000/api/auth/sign-up/email", {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
email: "bypass@example.com",
|
||||
name: "Bypass",
|
||||
password: "sicheres-passwort-123",
|
||||
}),
|
||||
}),
|
||||
);
|
||||
|
||||
expect(response.status).toBe(403);
|
||||
});
|
||||
@@ -0,0 +1,90 @@
|
||||
import "server-only";
|
||||
|
||||
import { drizzleAdapter } from "@better-auth/drizzle-adapter";
|
||||
import { betterAuth } from "better-auth";
|
||||
import { APIError, createAuthMiddleware } from "better-auth/api";
|
||||
|
||||
import { env } from "@/config/env";
|
||||
import { db } from "@/db/client";
|
||||
import { accounts, sessions, users, verifications } from "@/db/schema";
|
||||
import { mailer } from "@/modules/mail/mailer";
|
||||
|
||||
import {
|
||||
createEditorialRegistrationRepository,
|
||||
createRegistrationService,
|
||||
type RegistrationInput,
|
||||
} from "./registration";
|
||||
|
||||
const registrationRepository = createEditorialRegistrationRepository(db);
|
||||
|
||||
export const auth = betterAuth({
|
||||
baseURL: env.BETTER_AUTH_URL,
|
||||
secret: env.BETTER_AUTH_SECRET,
|
||||
database: drizzleAdapter(db, {
|
||||
provider: "pg",
|
||||
schema: {
|
||||
user: users,
|
||||
account: accounts,
|
||||
session: sessions,
|
||||
verification: verifications,
|
||||
},
|
||||
}),
|
||||
hooks: {
|
||||
before: createAuthMiddleware(async (context) => {
|
||||
if (context.path === "/sign-up/email") {
|
||||
throw new APIError("FORBIDDEN", {
|
||||
message: "Bitte verwenden Sie die Registrierung des Redaktionsportals.",
|
||||
});
|
||||
}
|
||||
}),
|
||||
},
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
requireEmailVerification: true,
|
||||
autoSignIn: false,
|
||||
resetPasswordTokenExpiresIn: 60 * 60,
|
||||
revokeSessionsOnPasswordReset: true,
|
||||
async sendResetPassword({ user, url }) {
|
||||
await mailer.sendPasswordReset({ to: user.email, resetUrl: url });
|
||||
},
|
||||
},
|
||||
emailVerification: {
|
||||
sendOnSignUp: false,
|
||||
autoSignInAfterVerification: false,
|
||||
expiresIn: 60 * 60,
|
||||
async sendVerificationEmail({ user, url }) {
|
||||
await mailer.sendVerification({ to: user.email, verificationUrl: url });
|
||||
},
|
||||
async afterEmailVerification(user) {
|
||||
await registrationService.onEmailVerified(user.id);
|
||||
},
|
||||
},
|
||||
databaseHooks: {
|
||||
session: {
|
||||
create: {
|
||||
async before(session) {
|
||||
return registrationRepository.canCreateSession(session.userId);
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const registrationService = createRegistrationService({
|
||||
auth: {
|
||||
async signUpEmail({ email, name, password }) {
|
||||
return auth.api.signUpEmail({ body: { email, name, password } });
|
||||
},
|
||||
async sendVerificationEmail({ email }) {
|
||||
await auth.api.sendVerificationEmail({
|
||||
body: { email, callbackURL: "/registrieren/bestaetigt" },
|
||||
});
|
||||
},
|
||||
},
|
||||
repo: registrationRepository,
|
||||
audit: registrationRepository,
|
||||
});
|
||||
|
||||
export function registerEditorial(input: RegistrationInput): Promise<{ status: "pending_email" }> {
|
||||
return registrationService.register(input);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import { createAuthClient } from "better-auth/react";
|
||||
|
||||
export const authClient = createAuthClient();
|
||||
@@ -0,0 +1,41 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { expect, test, vi } from "vitest";
|
||||
|
||||
import { RegistrationForm } from "./public-forms";
|
||||
|
||||
test("registration presents separate B2B, terms, and privacy acknowledgements", () => {
|
||||
render(
|
||||
<RegistrationForm
|
||||
action={vi.fn()}
|
||||
legalUrls={{
|
||||
imprint: "https://example.com/impressum",
|
||||
privacy: "https://example.com/datenschutz",
|
||||
terms: "https://example.com/nutzungsbedingungen",
|
||||
}}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(
|
||||
screen.getByRole("checkbox", {
|
||||
name: /im namen einer redaktion oder eines unternehmens/i,
|
||||
}),
|
||||
).toHaveProperty("required", true);
|
||||
expect(screen.getByRole("checkbox", { name: /nutzungs- und lizenzbedingungen/i })).toHaveProperty(
|
||||
"required",
|
||||
true,
|
||||
);
|
||||
expect(screen.getByRole("checkbox", { name: /datenschutzerklärung/i })).toHaveProperty(
|
||||
"required",
|
||||
true,
|
||||
);
|
||||
expect(screen.getByRole("link", { name: /nutzungs- und lizenzbedingungen/i })).toHaveProperty(
|
||||
"href",
|
||||
"https://example.com/nutzungsbedingungen",
|
||||
);
|
||||
expect(screen.getByRole("link", { name: /datenschutzerklärung/i })).toHaveProperty(
|
||||
"href",
|
||||
"https://example.com/datenschutz",
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,256 @@
|
||||
"use client";
|
||||
|
||||
import { type FormEvent, useActionState, useState } from "react";
|
||||
|
||||
import { authClient } from "./client";
|
||||
|
||||
export type RegistrationFormState = {
|
||||
errors?: Partial<
|
||||
Record<"actsForBusiness" | "termsVersion" | "privacyAcknowledged", string>
|
||||
>;
|
||||
};
|
||||
|
||||
export type RegistrationFormAction = (
|
||||
state: RegistrationFormState,
|
||||
formData: FormData,
|
||||
) => Promise<RegistrationFormState>;
|
||||
|
||||
export type LegalUrls = {
|
||||
imprint: string;
|
||||
privacy: string;
|
||||
terms: string;
|
||||
};
|
||||
|
||||
const initialRegistrationState: RegistrationFormState = {};
|
||||
|
||||
export function RegistrationForm({
|
||||
action,
|
||||
legalUrls,
|
||||
}: {
|
||||
action: RegistrationFormAction;
|
||||
legalUrls: LegalUrls;
|
||||
}) {
|
||||
const [state, formAction, pending] = useActionState(action, initialRegistrationState);
|
||||
|
||||
return (
|
||||
<form action={formAction} className="account-form">
|
||||
<input name="termsVersion" type="hidden" value="2026-08" />
|
||||
<div className="form-grid">
|
||||
<label>
|
||||
Redaktion oder Unternehmen
|
||||
<input autoComplete="organization" name="companyName" required />
|
||||
</label>
|
||||
<label>
|
||||
Ansprechpartner:in
|
||||
<input autoComplete="name" name="contactName" required />
|
||||
</label>
|
||||
<label>
|
||||
E-Mail-Adresse
|
||||
<input autoComplete="email" name="email" required type="email" />
|
||||
</label>
|
||||
<label>
|
||||
Passwort
|
||||
<input autoComplete="new-password" minLength={8} name="password" required type="password" />
|
||||
</label>
|
||||
<label>
|
||||
Straße und Hausnummer
|
||||
<input autoComplete="address-line1" name="addressLine1" required />
|
||||
</label>
|
||||
<label>
|
||||
Adresszusatz
|
||||
<input autoComplete="address-line2" name="addressLine2" />
|
||||
</label>
|
||||
<label>
|
||||
Postleitzahl
|
||||
<input autoComplete="postal-code" name="postalCode" required />
|
||||
</label>
|
||||
<label>
|
||||
Ort
|
||||
<input autoComplete="address-level2" name="city" required />
|
||||
</label>
|
||||
<label>
|
||||
Land (ISO-Code)
|
||||
<input
|
||||
autoComplete="country"
|
||||
defaultValue="DE"
|
||||
maxLength={2}
|
||||
name="countryCode"
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<fieldset className="acknowledgements">
|
||||
<legend>Verbindliche Angaben</legend>
|
||||
<label className="checkbox-label">
|
||||
<input name="actsForBusiness" required type="checkbox" />
|
||||
Ich handle im Namen einer Redaktion oder eines Unternehmens.
|
||||
</label>
|
||||
<FieldError message={state.errors?.actsForBusiness} />
|
||||
<label className="checkbox-label">
|
||||
<input name="termsAccepted" required type="checkbox" />
|
||||
Ich akzeptiere die{" "}
|
||||
<a href={legalUrls.terms} rel="noreferrer" target="_blank">
|
||||
Nutzungs- und Lizenzbedingungen
|
||||
</a>
|
||||
.
|
||||
</label>
|
||||
<FieldError message={state.errors?.termsVersion} />
|
||||
<label className="checkbox-label">
|
||||
<input name="privacyAcknowledged" required type="checkbox" />
|
||||
Ich habe die{" "}
|
||||
<a href={legalUrls.privacy} rel="noreferrer" target="_blank">
|
||||
Datenschutzerklärung
|
||||
</a>{" "}
|
||||
zur Kenntnis genommen.
|
||||
</label>
|
||||
<FieldError message={state.errors?.privacyAcknowledged} />
|
||||
</fieldset>
|
||||
|
||||
<button className="primary-action" disabled={pending} type="submit">
|
||||
{pending ? "Registrierung wird gesendet …" : "Registrierung senden"}
|
||||
</button>
|
||||
<p className="form-note">
|
||||
Wir informieren Sie auf der nächsten Seite über den weiteren Ablauf.
|
||||
</p>
|
||||
<a className="legal-link" href={legalUrls.imprint} rel="noreferrer" target="_blank">
|
||||
Impressum
|
||||
</a>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
export function LoginForm() {
|
||||
const [error, setError] = useState<string>();
|
||||
const [pending, setPending] = useState(false);
|
||||
|
||||
async function submit(event: FormEvent<HTMLFormElement>) {
|
||||
event.preventDefault();
|
||||
setPending(true);
|
||||
setError(undefined);
|
||||
|
||||
const formData = new FormData(event.currentTarget);
|
||||
const result = await authClient.signIn.email({
|
||||
email: readText(formData, "email").trim().toLowerCase(),
|
||||
password: readText(formData, "password"),
|
||||
callbackURL: "/",
|
||||
});
|
||||
|
||||
if (result.error) {
|
||||
setError("Die Anmeldung war nicht erfolgreich. Bitte prüfen Sie Ihre Angaben.");
|
||||
setPending(false);
|
||||
return;
|
||||
}
|
||||
|
||||
window.location.assign(result.data?.url ?? "/");
|
||||
}
|
||||
|
||||
return (
|
||||
<form className="account-form" onSubmit={submit}>
|
||||
<label>
|
||||
E-Mail-Adresse
|
||||
<input autoComplete="email" name="email" required type="email" />
|
||||
</label>
|
||||
<label>
|
||||
Passwort
|
||||
<input autoComplete="current-password" name="password" required type="password" />
|
||||
</label>
|
||||
<FieldError message={error} />
|
||||
<button className="primary-action" disabled={pending} type="submit">
|
||||
{pending ? "Anmeldung wird geprüft …" : "Anmelden"}
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
export function PasswordResetRequestForm() {
|
||||
const [submitted, setSubmitted] = useState(false);
|
||||
const [pending, setPending] = useState(false);
|
||||
|
||||
async function submit(event: FormEvent<HTMLFormElement>) {
|
||||
event.preventDefault();
|
||||
setPending(true);
|
||||
const formData = new FormData(event.currentTarget);
|
||||
|
||||
try {
|
||||
await authClient.requestPasswordReset({
|
||||
email: readText(formData, "email").trim().toLowerCase(),
|
||||
redirectTo: `${window.location.origin}/passwort-zuruecksetzen`,
|
||||
});
|
||||
} finally {
|
||||
setSubmitted(true);
|
||||
setPending(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (submitted) {
|
||||
return (
|
||||
<p className="form-note" role="status">
|
||||
Falls ein Zugang zu dieser Adresse gehört, erhalten Sie in Kürze weitere Hinweise.
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<form className="account-form" onSubmit={submit}>
|
||||
<label>
|
||||
E-Mail-Adresse
|
||||
<input autoComplete="email" name="email" required type="email" />
|
||||
</label>
|
||||
<button className="primary-action" disabled={pending} type="submit">
|
||||
{pending ? "Anfrage wird gesendet …" : "Link anfordern"}
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
export function PasswordResetForm({ token }: { token?: string }) {
|
||||
const [message, setMessage] = useState<string>();
|
||||
const [pending, setPending] = useState(false);
|
||||
|
||||
async function submit(event: FormEvent<HTMLFormElement>) {
|
||||
event.preventDefault();
|
||||
setPending(true);
|
||||
const formData = new FormData(event.currentTarget);
|
||||
|
||||
try {
|
||||
await authClient.resetPassword({ newPassword: readText(formData, "password"), token });
|
||||
} finally {
|
||||
setMessage("Wenn der Link gültig war, wurde Ihr Passwort aktualisiert.");
|
||||
setPending(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (message) {
|
||||
return (
|
||||
<p className="form-note" role="status">
|
||||
{message}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<form className="account-form" onSubmit={submit}>
|
||||
<label>
|
||||
Neues Passwort
|
||||
<input autoComplete="new-password" minLength={8} name="password" required type="password" />
|
||||
</label>
|
||||
<button className="primary-action" disabled={pending} type="submit">
|
||||
{pending ? "Passwort wird aktualisiert …" : "Passwort aktualisieren"}
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
function FieldError({ message }: { message?: string }) {
|
||||
return message ? (
|
||||
<p className="field-error" role="alert">
|
||||
{message}
|
||||
</p>
|
||||
) : null;
|
||||
}
|
||||
|
||||
function readText(formData: FormData, name: string): string {
|
||||
const value = formData.get(name);
|
||||
return typeof value === "string" ? value : "";
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
import { describe, expect, test, vi } from "vitest";
|
||||
|
||||
import {
|
||||
RegistrationValidationError,
|
||||
createRegistrationService,
|
||||
type RegistrationInput,
|
||||
} from "./registration";
|
||||
import { createAdminBootstrapService } from "./admin-bootstrap";
|
||||
|
||||
const validRegistration: RegistrationInput = {
|
||||
companyName: "Neue Redaktion GmbH",
|
||||
contactName: "Mara Muster",
|
||||
email: "Mara.Muster@Example.com",
|
||||
password: "sicheres-passwort-123",
|
||||
billingAddress: {
|
||||
addressLine1: "Presseweg 1",
|
||||
addressLine2: "Haus B",
|
||||
postalCode: "10115",
|
||||
city: "Berlin",
|
||||
countryCode: "DE",
|
||||
},
|
||||
actsForBusiness: true,
|
||||
termsVersion: "2026-08",
|
||||
privacyAcknowledged: true,
|
||||
};
|
||||
|
||||
function createService() {
|
||||
const auth = {
|
||||
signUpEmail: vi.fn().mockResolvedValue({ user: { id: "user-1" } }),
|
||||
sendVerificationEmail: vi.fn().mockResolvedValue(undefined),
|
||||
};
|
||||
const repo = {
|
||||
createEditorial: vi.fn().mockResolvedValue(undefined),
|
||||
markPendingApproval: vi.fn().mockResolvedValue(true),
|
||||
};
|
||||
const audit = {
|
||||
recordVerificationInconsistency: vi.fn().mockResolvedValue(undefined),
|
||||
};
|
||||
const now = new Date("2026-08-09T10:00:00.000Z");
|
||||
|
||||
return {
|
||||
auth,
|
||||
repo,
|
||||
audit,
|
||||
service: createRegistrationService({ auth, repo, audit, now: () => now }),
|
||||
};
|
||||
}
|
||||
|
||||
describe("editorial registration", () => {
|
||||
test("creates a pending editorial and sends verification mail", async () => {
|
||||
const { auth, repo, service } = createService();
|
||||
|
||||
await expect(service.register(validRegistration)).resolves.toEqual({ status: "pending_email" });
|
||||
|
||||
expect(auth.signUpEmail).toHaveBeenCalledWith({
|
||||
email: "mara.muster@example.com",
|
||||
name: "Mara Muster",
|
||||
password: "sicheres-passwort-123",
|
||||
});
|
||||
expect(repo.createEditorial).toHaveBeenCalledWith({
|
||||
userId: "user-1",
|
||||
name: "Neue Redaktion GmbH",
|
||||
contactName: "Mara Muster",
|
||||
loginEmail: "mara.muster@example.com",
|
||||
status: "pending_email",
|
||||
acceptedTermsVersion: "2026-08",
|
||||
acceptedTermsAt: new Date("2026-08-09T10:00:00.000Z"),
|
||||
privacyAcknowledgedAt: new Date("2026-08-09T10:00:00.000Z"),
|
||||
billingAddress: {
|
||||
companyName: "Neue Redaktion GmbH",
|
||||
contactName: "Mara Muster",
|
||||
addressLine1: "Presseweg 1",
|
||||
addressLine2: "Haus B",
|
||||
postalCode: "10115",
|
||||
city: "Berlin",
|
||||
countryCode: "DE",
|
||||
},
|
||||
});
|
||||
expect(auth.sendVerificationEmail).toHaveBeenCalledWith({
|
||||
email: "mara.muster@example.com",
|
||||
});
|
||||
});
|
||||
|
||||
test("rejects a registration that is not made for a business", async () => {
|
||||
const { auth, repo, service } = createService();
|
||||
|
||||
await expect(
|
||||
service.register({ ...validRegistration, actsForBusiness: false }),
|
||||
).rejects.toEqual(
|
||||
new RegistrationValidationError(
|
||||
"actsForBusiness",
|
||||
"Bitte bestätigen Sie, dass Sie im Namen eines Unternehmens oder einer Redaktion handeln.",
|
||||
),
|
||||
);
|
||||
|
||||
expect(auth.signUpEmail).not.toHaveBeenCalled();
|
||||
expect(repo.createEditorial).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("rejects missing terms and privacy acknowledgements with stable German field errors", async () => {
|
||||
const { service } = createService();
|
||||
|
||||
await expect(
|
||||
service.register({ ...validRegistration, termsVersion: "" }),
|
||||
).rejects.toEqual(
|
||||
new RegistrationValidationError(
|
||||
"termsVersion",
|
||||
"Bitte akzeptieren Sie die Nutzungs- und Lizenzbedingungen.",
|
||||
),
|
||||
);
|
||||
await expect(
|
||||
service.register({ ...validRegistration, privacyAcknowledged: false }),
|
||||
).rejects.toEqual(
|
||||
new RegistrationValidationError(
|
||||
"privacyAcknowledged",
|
||||
"Bitte bestätigen Sie die Kenntnisnahme der Datenschutzerklärung.",
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test("moves a verified account from pending email to pending approval", async () => {
|
||||
const { audit, repo, service } = createService();
|
||||
|
||||
await service.onEmailVerified("user-1");
|
||||
|
||||
expect(repo.markPendingApproval).toHaveBeenCalledWith("user-1");
|
||||
expect(audit.recordVerificationInconsistency).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("audits a verified user without an editorial account without raw request data", async () => {
|
||||
const { audit, repo, service } = createService();
|
||||
repo.markPendingApproval.mockResolvedValue(false);
|
||||
|
||||
await service.onEmailVerified("user-without-editorial");
|
||||
|
||||
expect(audit.recordVerificationInconsistency).toHaveBeenCalledWith({
|
||||
userId: "user-without-editorial",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test("bootstraps the first admin only once", async () => {
|
||||
const auth = {
|
||||
signUpEmail: vi.fn().mockResolvedValue({ user: { id: "admin-1" } }),
|
||||
sendVerificationEmail: vi.fn().mockResolvedValue(undefined),
|
||||
};
|
||||
const repo = {
|
||||
countAdmins: vi.fn().mockResolvedValue(0),
|
||||
findUserByEmail: vi.fn().mockResolvedValue(undefined),
|
||||
promoteUserToAdmin: vi.fn().mockResolvedValue(undefined),
|
||||
};
|
||||
const service = createAdminBootstrapService({ auth, repo });
|
||||
|
||||
await expect(
|
||||
service.bootstrap({
|
||||
email: "ADMIN@EXAMPLE.COM",
|
||||
name: "Portal Admin",
|
||||
password: "sicheres-passwort-123",
|
||||
}),
|
||||
).resolves.toEqual({ status: "created" });
|
||||
|
||||
expect(auth.signUpEmail).toHaveBeenCalledWith({
|
||||
email: "admin@example.com",
|
||||
name: "Portal Admin",
|
||||
password: "sicheres-passwort-123",
|
||||
});
|
||||
expect(repo.promoteUserToAdmin).toHaveBeenCalledWith("admin-1");
|
||||
expect(auth.sendVerificationEmail).toHaveBeenCalledWith({ email: "admin@example.com" });
|
||||
});
|
||||
@@ -0,0 +1,276 @@
|
||||
import "server-only";
|
||||
|
||||
import { and, eq } from "drizzle-orm";
|
||||
import type { NodePgDatabase } from "drizzle-orm/node-postgres";
|
||||
|
||||
import { auditEvents, billingAddressVersions, editorialAccounts, users } from "@/db/schema";
|
||||
import type * as schema from "@/db/schema";
|
||||
|
||||
export type BillingAddressInput = {
|
||||
addressLine1: string;
|
||||
addressLine2?: string;
|
||||
postalCode: string;
|
||||
city: string;
|
||||
countryCode: string;
|
||||
};
|
||||
|
||||
export type RegistrationInput = {
|
||||
companyName: string;
|
||||
contactName: string;
|
||||
email: string;
|
||||
password: string;
|
||||
billingAddress: BillingAddressInput;
|
||||
actsForBusiness: boolean;
|
||||
termsVersion: string;
|
||||
privacyAcknowledged: boolean;
|
||||
};
|
||||
|
||||
export type PendingEditorial = {
|
||||
userId: string;
|
||||
name: string;
|
||||
contactName: string;
|
||||
loginEmail: string;
|
||||
status: "pending_email";
|
||||
acceptedTermsVersion: string;
|
||||
acceptedTermsAt: Date;
|
||||
privacyAcknowledgedAt: Date;
|
||||
billingAddress: BillingAddressInput & { companyName: string; contactName: string };
|
||||
};
|
||||
|
||||
export type RegistrationAuth = {
|
||||
signUpEmail(input: { email: string; name: string; password: string }): Promise<{ user: { id: string } }>;
|
||||
sendVerificationEmail(input: { email: string }): Promise<void>;
|
||||
};
|
||||
|
||||
export type EditorialRegistrationRepository = {
|
||||
createEditorial(input: PendingEditorial): Promise<void>;
|
||||
markPendingApproval(userId: string): Promise<boolean>;
|
||||
};
|
||||
|
||||
export type RegistrationAudit = {
|
||||
recordVerificationInconsistency(input: { userId: string }): Promise<void>;
|
||||
};
|
||||
|
||||
export class RegistrationValidationError extends Error {
|
||||
readonly name = "RegistrationValidationError";
|
||||
|
||||
constructor(
|
||||
readonly field: "actsForBusiness" | "termsVersion" | "privacyAcknowledged",
|
||||
message: string,
|
||||
) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
export function createRegistrationService({
|
||||
auth,
|
||||
repo,
|
||||
audit,
|
||||
now = () => new Date(),
|
||||
}: {
|
||||
auth: RegistrationAuth;
|
||||
repo: EditorialRegistrationRepository;
|
||||
audit: RegistrationAudit;
|
||||
now?: () => Date;
|
||||
}) {
|
||||
return {
|
||||
async register(input: RegistrationInput): Promise<{ status: "pending_email" }> {
|
||||
const registration = validateRegistration(input);
|
||||
const result = await auth.signUpEmail({
|
||||
email: registration.loginEmail,
|
||||
name: registration.contactName,
|
||||
password: registration.password,
|
||||
});
|
||||
const acceptedAt = now();
|
||||
|
||||
await repo.createEditorial({
|
||||
userId: result.user.id,
|
||||
name: registration.companyName,
|
||||
contactName: registration.contactName,
|
||||
loginEmail: registration.loginEmail,
|
||||
status: "pending_email",
|
||||
acceptedTermsVersion: registration.termsVersion,
|
||||
acceptedTermsAt: acceptedAt,
|
||||
privacyAcknowledgedAt: acceptedAt,
|
||||
billingAddress: {
|
||||
companyName: registration.companyName,
|
||||
contactName: registration.contactName,
|
||||
...registration.billingAddress,
|
||||
},
|
||||
});
|
||||
|
||||
await auth.sendVerificationEmail({ email: registration.loginEmail });
|
||||
return { status: "pending_email" };
|
||||
},
|
||||
|
||||
async onEmailVerified(userId: string): Promise<void> {
|
||||
const transitioned = await repo.markPendingApproval(userId);
|
||||
if (!transitioned) {
|
||||
await audit.recordVerificationInconsistency({ userId });
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function createEditorialRegistrationRepository(database: NodePgDatabase<typeof schema>): {
|
||||
createEditorial(input: PendingEditorial): Promise<void>;
|
||||
markPendingApproval(userId: string): Promise<boolean>;
|
||||
recordVerificationInconsistency(input: { userId: string }): Promise<void>;
|
||||
canCreateSession(userId: string): Promise<boolean>;
|
||||
} {
|
||||
return {
|
||||
async createEditorial(input) {
|
||||
await database.transaction(async (transaction) => {
|
||||
const [user] = await transaction
|
||||
.select({ id: users.id })
|
||||
.from(users)
|
||||
.where(eq(users.id, input.userId))
|
||||
.limit(1);
|
||||
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
|
||||
const [existingEditorial] = await transaction
|
||||
.select({ id: editorialAccounts.id })
|
||||
.from(editorialAccounts)
|
||||
.where(eq(editorialAccounts.userId, input.userId))
|
||||
.limit(1);
|
||||
|
||||
if (existingEditorial) {
|
||||
return;
|
||||
}
|
||||
|
||||
const [editorial] = await transaction
|
||||
.insert(editorialAccounts)
|
||||
.values({
|
||||
userId: input.userId,
|
||||
name: input.name,
|
||||
contactName: input.contactName,
|
||||
loginEmail: input.loginEmail,
|
||||
status: input.status,
|
||||
acceptedTermsVersion: input.acceptedTermsVersion,
|
||||
acceptedTermsAt: input.acceptedTermsAt,
|
||||
privacyAcknowledgedAt: input.privacyAcknowledgedAt,
|
||||
})
|
||||
.returning({ id: editorialAccounts.id });
|
||||
|
||||
const [billingAddress] = await transaction
|
||||
.insert(billingAddressVersions)
|
||||
.values({
|
||||
editorialAccountId: editorial.id,
|
||||
companyName: input.billingAddress.companyName,
|
||||
contactName: input.billingAddress.contactName,
|
||||
addressLine1: input.billingAddress.addressLine1,
|
||||
addressLine2: input.billingAddress.addressLine2,
|
||||
postalCode: input.billingAddress.postalCode,
|
||||
city: input.billingAddress.city,
|
||||
countryCode: input.billingAddress.countryCode,
|
||||
validFrom: input.acceptedTermsAt,
|
||||
createdByUserId: input.userId,
|
||||
})
|
||||
.returning({ id: billingAddressVersions.id });
|
||||
|
||||
await transaction
|
||||
.update(editorialAccounts)
|
||||
.set({ currentBillingAddressVersionId: billingAddress.id, updatedAt: input.acceptedTermsAt })
|
||||
.where(eq(editorialAccounts.id, editorial.id));
|
||||
});
|
||||
},
|
||||
|
||||
async markPendingApproval(userId) {
|
||||
const verifiedAt = new Date();
|
||||
const [transitioned] = await database
|
||||
.update(editorialAccounts)
|
||||
.set({
|
||||
status: "pending_approval",
|
||||
emailVerifiedAt: verifiedAt,
|
||||
updatedAt: verifiedAt,
|
||||
})
|
||||
.where(
|
||||
and(
|
||||
eq(editorialAccounts.userId, userId),
|
||||
eq(editorialAccounts.status, "pending_email"),
|
||||
),
|
||||
)
|
||||
.returning({ id: editorialAccounts.id });
|
||||
|
||||
if (transitioned) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const [existingEditorial] = await database
|
||||
.select({ id: editorialAccounts.id })
|
||||
.from(editorialAccounts)
|
||||
.where(eq(editorialAccounts.userId, userId))
|
||||
.limit(1);
|
||||
|
||||
return Boolean(existingEditorial);
|
||||
},
|
||||
|
||||
async recordVerificationInconsistency({ userId }) {
|
||||
await database.insert(auditEvents).values({
|
||||
eventType: "email_verification_without_editorial_account",
|
||||
actorUserId: userId,
|
||||
actorType: "system",
|
||||
entityType: "user",
|
||||
entityId: userId,
|
||||
newValues: { reason: "no_editorial_account" },
|
||||
});
|
||||
},
|
||||
|
||||
async canCreateSession(userId) {
|
||||
const [principal] = await database
|
||||
.select({ role: users.role, status: editorialAccounts.status })
|
||||
.from(users)
|
||||
.leftJoin(editorialAccounts, eq(editorialAccounts.userId, users.id))
|
||||
.where(eq(users.id, userId))
|
||||
.limit(1);
|
||||
|
||||
return principal?.role === "ADMIN" || principal?.status === "active";
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function validateRegistration(input: RegistrationInput): {
|
||||
companyName: string;
|
||||
contactName: string;
|
||||
loginEmail: string;
|
||||
password: string;
|
||||
termsVersion: string;
|
||||
billingAddress: BillingAddressInput;
|
||||
} {
|
||||
if (!input.actsForBusiness) {
|
||||
throw new RegistrationValidationError(
|
||||
"actsForBusiness",
|
||||
"Bitte bestätigen Sie, dass Sie im Namen eines Unternehmens oder einer Redaktion handeln.",
|
||||
);
|
||||
}
|
||||
if (!input.termsVersion.trim()) {
|
||||
throw new RegistrationValidationError(
|
||||
"termsVersion",
|
||||
"Bitte akzeptieren Sie die Nutzungs- und Lizenzbedingungen.",
|
||||
);
|
||||
}
|
||||
if (!input.privacyAcknowledged) {
|
||||
throw new RegistrationValidationError(
|
||||
"privacyAcknowledged",
|
||||
"Bitte bestätigen Sie die Kenntnisnahme der Datenschutzerklärung.",
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
companyName: input.companyName.trim(),
|
||||
contactName: input.contactName.trim(),
|
||||
loginEmail: input.email.trim().toLowerCase(),
|
||||
password: input.password,
|
||||
termsVersion: input.termsVersion.trim(),
|
||||
billingAddress: {
|
||||
addressLine1: input.billingAddress.addressLine1.trim(),
|
||||
addressLine2: input.billingAddress.addressLine2?.trim() || undefined,
|
||||
postalCode: input.billingAddress.postalCode.trim(),
|
||||
city: input.billingAddress.city.trim(),
|
||||
countryCode: input.billingAddress.countryCode.trim().toUpperCase(),
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
import { expect, test, vi } from "vitest";
|
||||
|
||||
import { createMailer } from "./mailer";
|
||||
|
||||
test("sends a verification link through the configured SMTP boundary", async () => {
|
||||
const transport = { sendMail: vi.fn().mockResolvedValue({ messageId: "message-1" }) };
|
||||
const mailer = createMailer({ from: "portal@example.com", transport });
|
||||
|
||||
await mailer.sendVerification({
|
||||
to: "editorial@example.com",
|
||||
verificationUrl: "https://portal.example.com/api/auth/verify-email?token=secret-token",
|
||||
});
|
||||
|
||||
expect(transport.sendMail).toHaveBeenCalledWith({
|
||||
from: "portal@example.com",
|
||||
to: "editorial@example.com",
|
||||
subject: "Bitte bestätigen Sie Ihre E-Mail-Adresse",
|
||||
text: expect.stringContaining(
|
||||
"https://portal.example.com/api/auth/verify-email?token=secret-token",
|
||||
),
|
||||
});
|
||||
});
|
||||
|
||||
test("sends an approval notice without leaking SMTP credentials", async () => {
|
||||
const transport = { sendMail: vi.fn().mockResolvedValue({ messageId: "message-2" }) };
|
||||
const mailer = createMailer({ from: "portal@example.com", transport });
|
||||
|
||||
await mailer.sendApprovalNotice({ to: "editorial@example.com", editorialName: "Neue Redaktion" });
|
||||
|
||||
expect(transport.sendMail).toHaveBeenCalledWith({
|
||||
from: "portal@example.com",
|
||||
to: "editorial@example.com",
|
||||
subject: "Ihr Zugang zum Redaktionsportal ist freigegeben",
|
||||
text: expect.stringContaining("Neue Redaktion"),
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,64 @@
|
||||
import "server-only";
|
||||
|
||||
import nodemailer from "nodemailer";
|
||||
|
||||
import { env } from "@/config/env";
|
||||
|
||||
export type MailMessage = {
|
||||
from: string;
|
||||
to: string;
|
||||
subject: string;
|
||||
text: string;
|
||||
};
|
||||
|
||||
export type MailTransport = {
|
||||
sendMail(message: MailMessage): Promise<unknown>;
|
||||
};
|
||||
|
||||
export type Mailer = {
|
||||
sendVerification(input: { to: string; verificationUrl: string }): Promise<void>;
|
||||
sendPasswordReset(input: { to: string; resetUrl: string }): Promise<void>;
|
||||
sendApprovalNotice(input: { to: string; editorialName: string }): Promise<void>;
|
||||
};
|
||||
|
||||
export function createMailer({ from, transport }: { from: string; transport: MailTransport }): Mailer {
|
||||
async function send(message: Omit<MailMessage, "from">): Promise<void> {
|
||||
await transport.sendMail({ from, ...message });
|
||||
}
|
||||
|
||||
return {
|
||||
async sendVerification({ to, verificationUrl }) {
|
||||
await send({
|
||||
to,
|
||||
subject: "Bitte bestätigen Sie Ihre E-Mail-Adresse",
|
||||
text: `Bitte bestätigen Sie Ihre E-Mail-Adresse für das Redaktionsportal:\n\n${verificationUrl}`,
|
||||
});
|
||||
},
|
||||
async sendPasswordReset({ to, resetUrl }) {
|
||||
await send({
|
||||
to,
|
||||
subject: "Passwort für das Redaktionsportal zurücksetzen",
|
||||
text: `Setzen Sie Ihr Passwort für das Redaktionsportal zurück:\n\n${resetUrl}`,
|
||||
});
|
||||
},
|
||||
async sendApprovalNotice({ to, editorialName }) {
|
||||
await send({
|
||||
to,
|
||||
subject: "Ihr Zugang zum Redaktionsportal ist freigegeben",
|
||||
text: `Der Zugang für ${editorialName} wurde freigegeben. Sie können sich jetzt im Redaktionsportal anmelden.`,
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const smtpTransport = nodemailer.createTransport({
|
||||
host: env.SMTP_HOST,
|
||||
port: env.SMTP_PORT,
|
||||
secure: env.SMTP_PORT === 465,
|
||||
auth: {
|
||||
user: env.SMTP_USER,
|
||||
pass: env.SMTP_PASSWORD,
|
||||
},
|
||||
});
|
||||
|
||||
export const mailer = createMailer({ from: env.SMTP_FROM, transport: smtpTransport });
|
||||
Reference in new issue
Block a user