@softure-ai/auth 0.0.0-stage → 0.1.7
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 +15 -0
- package/LICENSE +21 -0
- package/README.md +490 -2
- package/dist/contract.d.ts +46 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +2 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.d.ts +194 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +84 -0
- package/dist/index.js.map +1 -0
- package/dist/mailing/index.d.ts +2 -0
- package/dist/mailing/index.d.ts.map +1 -0
- package/dist/mailing/index.js +4 -0
- package/dist/mailing/index.js.map +1 -0
- package/dist/mailing/reset-mail.d.ts +27 -0
- package/dist/mailing/reset-mail.d.ts.map +1 -0
- package/dist/mailing/reset-mail.js +55 -0
- package/dist/mailing/reset-mail.js.map +1 -0
- package/dist/messages/en.d.ts +98 -0
- package/dist/messages/en.d.ts.map +1 -0
- package/dist/messages/en.js +93 -0
- package/dist/messages/en.js.map +1 -0
- package/dist/messages/index.d.ts +201 -0
- package/dist/messages/index.d.ts.map +1 -0
- package/dist/messages/index.js +11 -0
- package/dist/messages/index.js.map +1 -0
- package/dist/messages/pl.d.ts +3 -0
- package/dist/messages/pl.d.ts.map +1 -0
- package/dist/messages/pl.js +92 -0
- package/dist/messages/pl.js.map +1 -0
- package/dist/next/actions.d.ts +19 -0
- package/dist/next/actions.d.ts.map +1 -0
- package/dist/next/actions.js +231 -0
- package/dist/next/actions.js.map +1 -0
- package/dist/next/context.d.ts +4 -0
- package/dist/next/context.d.ts.map +1 -0
- package/dist/next/context.js +13 -0
- package/dist/next/context.js.map +1 -0
- package/dist/next/current-user.d.ts +34 -0
- package/dist/next/current-user.d.ts.map +1 -0
- package/dist/next/current-user.js +77 -0
- package/dist/next/current-user.js.map +1 -0
- package/dist/next/index.d.ts +8 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +9 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/logout-button.d.ts +7 -0
- package/dist/next/logout-button.d.ts.map +1 -0
- package/dist/next/logout-button.js +12 -0
- package/dist/next/logout-button.js.map +1 -0
- package/dist/next/messages.d.ts +5 -0
- package/dist/next/messages.d.ts.map +1 -0
- package/dist/next/messages.js +7 -0
- package/dist/next/messages.js.map +1 -0
- package/dist/next/pages.d.ts +31 -0
- package/dist/next/pages.d.ts.map +1 -0
- package/dist/next/pages.js +118 -0
- package/dist/next/pages.js.map +1 -0
- package/dist/next/params.d.ts +3 -0
- package/dist/next/params.d.ts.map +1 -0
- package/dist/next/params.js +4 -0
- package/dist/next/params.js.map +1 -0
- package/dist/next/route.d.ts +3 -0
- package/dist/next/route.d.ts.map +1 -0
- package/dist/next/route.js +17 -0
- package/dist/next/route.js.map +1 -0
- package/dist/next/search-params.d.ts +5 -0
- package/dist/next/search-params.d.ts.map +1 -0
- package/dist/next/search-params.js +13 -0
- package/dist/next/search-params.js.map +1 -0
- package/dist/next/session-cookie.d.ts +11 -0
- package/dist/next/session-cookie.d.ts.map +1 -0
- package/dist/next/session-cookie.js +71 -0
- package/dist/next/session-cookie.js.map +1 -0
- package/dist/options.d.ts +72 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +115 -0
- package/dist/options.js.map +1 -0
- package/dist/password-reset-sender.d.ts +21 -0
- package/dist/password-reset-sender.d.ts.map +1 -0
- package/dist/password-reset-sender.js +12 -0
- package/dist/password-reset-sender.js.map +1 -0
- package/dist/proxy/index.d.ts +14 -0
- package/dist/proxy/index.d.ts.map +1 -0
- package/dist/proxy/index.js +59 -0
- package/dist/proxy/index.js.map +1 -0
- package/dist/redirect-target.d.ts +7 -0
- package/dist/redirect-target.d.ts.map +1 -0
- package/dist/redirect-target.js +25 -0
- package/dist/redirect-target.js.map +1 -0
- package/dist/roles.d.ts +5 -0
- package/dist/roles.d.ts.map +1 -0
- package/dist/roles.js +6 -0
- package/dist/roles.js.map +1 -0
- package/dist/safe-next-path.d.ts +5 -0
- package/dist/safe-next-path.d.ts.map +1 -0
- package/dist/safe-next-path.js +25 -0
- package/dist/safe-next-path.js.map +1 -0
- package/dist/schema.d.ts +302 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +37 -0
- package/dist/schema.js.map +1 -0
- package/dist/scripts/index.d.ts +3 -0
- package/dist/scripts/index.d.ts.map +1 -0
- package/dist/scripts/index.js +5 -0
- package/dist/scripts/index.js.map +1 -0
- package/dist/scripts/role-scripts.d.ts +15 -0
- package/dist/scripts/role-scripts.d.ts.map +1 -0
- package/dist/scripts/role-scripts.js +76 -0
- package/dist/scripts/role-scripts.js.map +1 -0
- package/dist/scripts/temporary-password.d.ts +12 -0
- package/dist/scripts/temporary-password.d.ts.map +1 -0
- package/dist/scripts/temporary-password.js +47 -0
- package/dist/scripts/temporary-password.js.map +1 -0
- package/dist/server/change-password.d.ts +14 -0
- package/dist/server/change-password.d.ts.map +1 -0
- package/dist/server/change-password.js +50 -0
- package/dist/server/change-password.js.map +1 -0
- package/dist/server/health.d.ts +3 -0
- package/dist/server/health.d.ts.map +1 -0
- package/dist/server/health.js +15 -0
- package/dist/server/health.js.map +1 -0
- package/dist/server/index.d.ts +12 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +14 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/login.d.ts +14 -0
- package/dist/server/login.d.ts.map +1 -0
- package/dist/server/login.js +50 -0
- package/dist/server/login.js.map +1 -0
- package/dist/server/options.d.ts +19 -0
- package/dist/server/options.d.ts.map +1 -0
- package/dist/server/options.js +50 -0
- package/dist/server/options.js.map +1 -0
- package/dist/server/password-reset.d.ts +54 -0
- package/dist/server/password-reset.d.ts.map +1 -0
- package/dist/server/password-reset.js +134 -0
- package/dist/server/password-reset.js.map +1 -0
- package/dist/server/password.d.ts +25 -0
- package/dist/server/password.d.ts.map +1 -0
- package/dist/server/password.js +93 -0
- package/dist/server/password.js.map +1 -0
- package/dist/server/privacy.d.ts +33 -0
- package/dist/server/privacy.d.ts.map +1 -0
- package/dist/server/privacy.js +52 -0
- package/dist/server/privacy.js.map +1 -0
- package/dist/server/rate-limits.d.ts +22 -0
- package/dist/server/rate-limits.d.ts.map +1 -0
- package/dist/server/rate-limits.js +45 -0
- package/dist/server/rate-limits.js.map +1 -0
- package/dist/server/reauthenticate.d.ts +7 -0
- package/dist/server/reauthenticate.d.ts.map +1 -0
- package/dist/server/reauthenticate.js +16 -0
- package/dist/server/reauthenticate.js.map +1 -0
- package/dist/server/register.d.ts +23 -0
- package/dist/server/register.d.ts.map +1 -0
- package/dist/server/register.js +64 -0
- package/dist/server/register.js.map +1 -0
- package/dist/server/roles.d.ts +25 -0
- package/dist/server/roles.d.ts.map +1 -0
- package/dist/server/roles.js +56 -0
- package/dist/server/roles.js.map +1 -0
- package/dist/server/session-token.d.ts +12 -0
- package/dist/server/session-token.d.ts.map +1 -0
- package/dist/server/session-token.js +22 -0
- package/dist/server/session-token.js.map +1 -0
- package/dist/server/sessions.d.ts +24 -0
- package/dist/server/sessions.d.ts.map +1 -0
- package/dist/server/sessions.js +50 -0
- package/dist/server/sessions.js.map +1 -0
- package/dist/server/switches.d.ts +9 -0
- package/dist/server/switches.d.ts.map +1 -0
- package/dist/server/switches.js +34 -0
- package/dist/server/switches.js.map +1 -0
- package/dist/server/validation.d.ts +10 -0
- package/dist/server/validation.d.ts.map +1 -0
- package/dist/server/validation.js +32 -0
- package/dist/server/validation.js.map +1 -0
- package/dist/session-cookie.d.ts +14 -0
- package/dist/session-cookie.d.ts.map +1 -0
- package/dist/session-cookie.js +31 -0
- package/dist/session-cookie.js.map +1 -0
- package/dist/testing/account.d.ts +17 -0
- package/dist/testing/account.d.ts.map +1 -0
- package/dist/testing/account.js +31 -0
- package/dist/testing/account.js.map +1 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +4 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/ui/auth-forms.d.ts +64 -0
- package/dist/ui/auth-forms.d.ts.map +1 -0
- package/dist/ui/auth-forms.js +67 -0
- package/dist/ui/auth-forms.js.map +1 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +4 -0
- package/dist/ui/index.js.map +1 -0
- package/migrations/0001_create_users_and_sessions.sql +25 -0
- package/migrations/0002_create_user_roles.sql +10 -0
- package/migrations/0003_create_password_resets.sql +15 -0
- package/migrations/0004_index_users_created_at.sql +5 -0
- package/module.json +34 -0
- package/package.json +97 -4
- package/src/contract.ts +67 -0
- package/src/index.ts +100 -0
- package/src/mailing/index.ts +3 -0
- package/src/mailing/reset-mail.ts +73 -0
- package/src/messages/en.ts +92 -0
- package/src/messages/index.ts +15 -0
- package/src/messages/pl.ts +93 -0
- package/src/next/actions.ts +240 -0
- package/src/next/context.ts +14 -0
- package/src/next/current-user.ts +90 -0
- package/src/next/index.ts +33 -0
- package/src/next/logout-button.tsx +22 -0
- package/src/next/messages.ts +9 -0
- package/src/next/next-modules.d.ts +16 -0
- package/src/next/pages.tsx +223 -0
- package/src/next/params.ts +4 -0
- package/src/next/route.ts +17 -0
- package/src/next/search-params.ts +14 -0
- package/src/next/session-cookie.ts +79 -0
- package/src/options.ts +154 -0
- package/src/password-reset-sender.ts +33 -0
- package/src/proxy/index.ts +85 -0
- package/src/redirect-target.ts +24 -0
- package/src/roles.ts +7 -0
- package/src/safe-next-path.ts +21 -0
- package/src/schema.ts +45 -0
- package/src/scripts/index.ts +8 -0
- package/src/scripts/role-scripts.ts +98 -0
- package/src/scripts/temporary-password.ts +62 -0
- package/src/server/change-password.ts +64 -0
- package/src/server/health.ts +16 -0
- package/src/server/index.ts +46 -0
- package/src/server/login.ts +61 -0
- package/src/server/options.ts +64 -0
- package/src/server/password-reset.ts +164 -0
- package/src/server/password.ts +108 -0
- package/src/server/privacy.ts +70 -0
- package/src/server/rate-limits.ts +51 -0
- package/src/server/reauthenticate.ts +16 -0
- package/src/server/register.ts +87 -0
- package/src/server/roles.ts +72 -0
- package/src/server/session-token.ts +25 -0
- package/src/server/sessions.ts +65 -0
- package/src/server/switches.ts +31 -0
- package/src/server/validation.ts +37 -0
- package/src/session-cookie.ts +47 -0
- package/src/testing/account.ts +43 -0
- package/src/testing/index.ts +3 -0
- package/src/ui/auth-forms.tsx +383 -0
- package/src/ui/index.ts +16 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
export declare const MODULE_ID = "auth";
|
|
2
|
+
/** Name of the runtime switch that closes registration. */
|
|
3
|
+
export declare const REGISTRATION_CLOSED_SWITCH = "auth.registration_closed";
|
|
4
|
+
/**
|
|
5
|
+
* The env override of that switch: `true`/`1` or `false`/`0` while auth reads it itself. When the app
|
|
6
|
+
* defines the switch in `@softure-ai/feature-switches`, that module reads the same variable.
|
|
7
|
+
*/
|
|
8
|
+
export declare const REGISTRATION_CLOSED_ENV = "SOFTURE_SWITCH_AUTH_REGISTRATION_CLOSED";
|
|
9
|
+
/**
|
|
10
|
+
* Rate limit buckets auth consumes, with defaults to spread into `security({ buckets })`:
|
|
11
|
+
* `register` and `login` per client address, `login-account` per email, `change-password` per user,
|
|
12
|
+
* `password-reset` (link requests) and `password-reset-confirm` (new passwords) per client address,
|
|
13
|
+
* and `password-reset-account` per email, which bounds the mails one address can receive.
|
|
14
|
+
*/
|
|
15
|
+
export declare const AUTH_RATE_LIMIT_BUCKETS: {
|
|
16
|
+
readonly register: {
|
|
17
|
+
readonly limit: 5;
|
|
18
|
+
readonly windowMinutes: 15;
|
|
19
|
+
};
|
|
20
|
+
readonly login: {
|
|
21
|
+
readonly limit: 50;
|
|
22
|
+
readonly windowMinutes: 15;
|
|
23
|
+
};
|
|
24
|
+
readonly "login-account": {
|
|
25
|
+
readonly limit: 10;
|
|
26
|
+
readonly windowMinutes: 15;
|
|
27
|
+
};
|
|
28
|
+
readonly "change-password": {
|
|
29
|
+
readonly limit: 10;
|
|
30
|
+
readonly windowMinutes: 15;
|
|
31
|
+
};
|
|
32
|
+
readonly "password-reset": {
|
|
33
|
+
readonly limit: 10;
|
|
34
|
+
readonly windowMinutes: 15;
|
|
35
|
+
};
|
|
36
|
+
readonly "password-reset-account": {
|
|
37
|
+
readonly limit: 3;
|
|
38
|
+
readonly windowMinutes: 15;
|
|
39
|
+
};
|
|
40
|
+
readonly "password-reset-confirm": {
|
|
41
|
+
readonly limit: 10;
|
|
42
|
+
readonly windowMinutes: 15;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Enables accounts in `softure.config.ts` (next to `security({ ... })`):
|
|
47
|
+
* `auth({ routes: { afterLogin: "/dashboard" }, password: { minLength: 12 } })`.
|
|
48
|
+
*/
|
|
49
|
+
export declare const auth: import("@softure-ai/core").ModuleFactory<{
|
|
50
|
+
login: string;
|
|
51
|
+
register: string;
|
|
52
|
+
changePassword: string;
|
|
53
|
+
forgotPassword: string;
|
|
54
|
+
resetPassword: string;
|
|
55
|
+
afterLogin: string;
|
|
56
|
+
afterLogout: string;
|
|
57
|
+
}, {
|
|
58
|
+
fields: {
|
|
59
|
+
email: string;
|
|
60
|
+
password: string;
|
|
61
|
+
currentPassword: string;
|
|
62
|
+
newPassword: string;
|
|
63
|
+
newPasswordHint: string;
|
|
64
|
+
consent: string;
|
|
65
|
+
};
|
|
66
|
+
login: {
|
|
67
|
+
title: string;
|
|
68
|
+
lead: string;
|
|
69
|
+
submit: string;
|
|
70
|
+
pending: string;
|
|
71
|
+
noAccount: string;
|
|
72
|
+
registerLink: string;
|
|
73
|
+
forgotPassword: string;
|
|
74
|
+
};
|
|
75
|
+
register: {
|
|
76
|
+
title: string;
|
|
77
|
+
lead: string;
|
|
78
|
+
submit: string;
|
|
79
|
+
pending: string;
|
|
80
|
+
hasAccount: string;
|
|
81
|
+
loginLink: string;
|
|
82
|
+
closedTitle: string;
|
|
83
|
+
closedBody: string;
|
|
84
|
+
};
|
|
85
|
+
changePassword: {
|
|
86
|
+
title: string;
|
|
87
|
+
lead: string;
|
|
88
|
+
submit: string;
|
|
89
|
+
pending: string;
|
|
90
|
+
success: string;
|
|
91
|
+
};
|
|
92
|
+
forgotPassword: {
|
|
93
|
+
title: string;
|
|
94
|
+
lead: string;
|
|
95
|
+
submit: string;
|
|
96
|
+
pending: string;
|
|
97
|
+
sent: string;
|
|
98
|
+
backToLogin: string;
|
|
99
|
+
};
|
|
100
|
+
resetPassword: {
|
|
101
|
+
title: string;
|
|
102
|
+
lead: string;
|
|
103
|
+
submit: string;
|
|
104
|
+
pending: string;
|
|
105
|
+
success: string;
|
|
106
|
+
invalidTitle: string;
|
|
107
|
+
invalidBody: string;
|
|
108
|
+
requestNew: string;
|
|
109
|
+
};
|
|
110
|
+
resetMail: {
|
|
111
|
+
subject: string;
|
|
112
|
+
greeting: string;
|
|
113
|
+
intro: string;
|
|
114
|
+
action: string;
|
|
115
|
+
expiry: string;
|
|
116
|
+
minutes: {
|
|
117
|
+
one: string;
|
|
118
|
+
few: string;
|
|
119
|
+
many: string;
|
|
120
|
+
other: string;
|
|
121
|
+
};
|
|
122
|
+
ignore: string;
|
|
123
|
+
};
|
|
124
|
+
logout: {
|
|
125
|
+
submit: string;
|
|
126
|
+
};
|
|
127
|
+
errors: {
|
|
128
|
+
auth: {
|
|
129
|
+
invalid_credentials: string;
|
|
130
|
+
email_invalid: string;
|
|
131
|
+
email_taken: string;
|
|
132
|
+
password_too_short: string;
|
|
133
|
+
password_too_long: string;
|
|
134
|
+
consent_required: string;
|
|
135
|
+
registration_closed: string;
|
|
136
|
+
current_password_invalid: string;
|
|
137
|
+
password_unchanged: string;
|
|
138
|
+
unauthenticated: string;
|
|
139
|
+
forbidden: string;
|
|
140
|
+
reset_token_invalid: string;
|
|
141
|
+
password_reset_unavailable: string;
|
|
142
|
+
};
|
|
143
|
+
security: {
|
|
144
|
+
rate_limited: string;
|
|
145
|
+
client_unidentified: string;
|
|
146
|
+
};
|
|
147
|
+
core: {
|
|
148
|
+
database_failed: string;
|
|
149
|
+
unexpected: string;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
}, import("zod").ZodObject<{
|
|
153
|
+
password: import("zod").ZodPrefault<import("zod").ZodObject<{
|
|
154
|
+
minLength: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
155
|
+
scrypt: import("zod").ZodPrefault<import("zod").ZodObject<{
|
|
156
|
+
cost: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
157
|
+
blockSize: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
158
|
+
parallelization: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
159
|
+
}, import("zod/v4/core").$strict>>;
|
|
160
|
+
}, import("zod/v4/core").$strict>>;
|
|
161
|
+
session: import("zod").ZodPrefault<import("zod").ZodObject<{
|
|
162
|
+
ttlDays: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
163
|
+
}, import("zod/v4/core").$strict>>;
|
|
164
|
+
cookie: import("zod").ZodPrefault<import("zod").ZodObject<{
|
|
165
|
+
name: import("zod").ZodDefault<import("zod").ZodString>;
|
|
166
|
+
domain: import("zod").ZodOptional<import("zod").ZodString>;
|
|
167
|
+
secure: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
168
|
+
}, import("zod/v4/core").$strict>>;
|
|
169
|
+
legacySession: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
170
|
+
cookieName: import("zod").ZodString;
|
|
171
|
+
tokenPattern: import("zod").ZodCustom<RegExp, RegExp>;
|
|
172
|
+
}, import("zod/v4/core").$strict>>;
|
|
173
|
+
registrationFields: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
174
|
+
requireConsent: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
175
|
+
registrationClosed: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
176
|
+
roles: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodString>>;
|
|
177
|
+
adminEmails: import("zod").ZodDefault<import("zod").ZodArray<import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodEmail>>>;
|
|
178
|
+
passwordReset: import("zod").ZodPrefault<import("zod").ZodObject<{
|
|
179
|
+
send: import("zod").ZodOptional<import("zod").ZodCustom<import("./password-reset-sender.js").PasswordResetSender, import("./password-reset-sender.js").PasswordResetSender>>;
|
|
180
|
+
ttlMinutes: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
181
|
+
}, import("zod/v4/core").$strict>>;
|
|
182
|
+
onRegistered: import("zod").ZodOptional<import("zod").ZodCustom<import("./options.js").OnRegisteredHook, import("./options.js").OnRegisteredHook>>;
|
|
183
|
+
rewriteRedirect: import("zod").ZodOptional<import("zod").ZodCustom<import("./options.js").RewriteRedirect, import("./options.js").RewriteRedirect>>;
|
|
184
|
+
}, import("zod/v4/core").$strict>>;
|
|
185
|
+
export { INITIAL_AUTH_FORM_STATE } from "./contract.js";
|
|
186
|
+
export type { AuthErrorCode, AuthFormErrorCode, AuthFormField, AuthFormState, AuthUser, NewSession, RegisteredEvent, SignedIn, } from "./contract.js";
|
|
187
|
+
export { authMessages, getAuthErrorMessage, type AuthMessages } from "./messages/index.js";
|
|
188
|
+
export type { AuthOptions, AuthOptionsInput, OnRegisteredHook, RewriteRedirect, RewriteRedirectContext, ScryptParams } from "./options.js";
|
|
189
|
+
export { consolePasswordResetSender, type PasswordResetDetails, type PasswordResetSender } from "./password-reset-sender.js";
|
|
190
|
+
export { getSessionCookie, type SessionCookie } from "./session-cookie.js";
|
|
191
|
+
export { toSafeNextPath } from "./safe-next-path.js";
|
|
192
|
+
export { ADMIN_ROLE, ROLE_NAME_PATTERN } from "./roles.js";
|
|
193
|
+
export { passwordResets, sessions, userRoles, users } from "./schema.js";
|
|
194
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,SA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
+
// Public API of @softure-ai/auth: the module factory for softure.config.ts, its types, messages and
|
|
2
|
+
// tables, and the development reset sender. Database work is in `@softure-ai/auth/server`, the Next.js adapter in `/next`, the route
|
|
3
|
+
// guard in `/proxy`, the forms in `/ui` and the role scripts in `/scripts`.
|
|
4
|
+
import { defineModule, resolveMigrationsDir } from "@softure-ai/core";
|
|
5
|
+
import { authMessages } from "./messages/index.js";
|
|
6
|
+
import { authOptionsSchema } from "./options.js";
|
|
7
|
+
import { checkAuthTables } from "./server/health.js";
|
|
8
|
+
import { authPrivacyContributor } from "./server/privacy.js";
|
|
9
|
+
export const MODULE_ID = "auth";
|
|
10
|
+
/** Name of the runtime switch that closes registration. */
|
|
11
|
+
export const REGISTRATION_CLOSED_SWITCH = "auth.registration_closed";
|
|
12
|
+
/**
|
|
13
|
+
* The env override of that switch: `true`/`1` or `false`/`0` while auth reads it itself. When the app
|
|
14
|
+
* defines the switch in `@softure-ai/feature-switches`, that module reads the same variable.
|
|
15
|
+
*/
|
|
16
|
+
export const REGISTRATION_CLOSED_ENV = "SOFTURE_SWITCH_AUTH_REGISTRATION_CLOSED";
|
|
17
|
+
/**
|
|
18
|
+
* Rate limit buckets auth consumes, with defaults to spread into `security({ buckets })`:
|
|
19
|
+
* `register` and `login` per client address, `login-account` per email, `change-password` per user,
|
|
20
|
+
* `password-reset` (link requests) and `password-reset-confirm` (new passwords) per client address,
|
|
21
|
+
* and `password-reset-account` per email, which bounds the mails one address can receive.
|
|
22
|
+
*/
|
|
23
|
+
export const AUTH_RATE_LIMIT_BUCKETS = {
|
|
24
|
+
register: { limit: 5, windowMinutes: 15 },
|
|
25
|
+
login: { limit: 50, windowMinutes: 15 },
|
|
26
|
+
"login-account": { limit: 10, windowMinutes: 15 },
|
|
27
|
+
"change-password": { limit: 10, windowMinutes: 15 },
|
|
28
|
+
"password-reset": { limit: 10, windowMinutes: 15 },
|
|
29
|
+
"password-reset-account": { limit: 3, windowMinutes: 15 },
|
|
30
|
+
"password-reset-confirm": { limit: 10, windowMinutes: 15 },
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Enables accounts in `softure.config.ts` (next to `security({ ... })`):
|
|
34
|
+
* `auth({ routes: { afterLogin: "/dashboard" }, password: { minLength: 12 } })`.
|
|
35
|
+
*/
|
|
36
|
+
export const auth = defineModule({
|
|
37
|
+
manifest: {
|
|
38
|
+
id: MODULE_ID,
|
|
39
|
+
version: "0.1.7",
|
|
40
|
+
dependsOn: { security: "^0.1.0", mailing: "^0.1.0?", ops: "^0.1.0?" },
|
|
41
|
+
dbSchema: "auth",
|
|
42
|
+
tables: ["users", "sessions", "user_roles", "password_resets"],
|
|
43
|
+
env: [
|
|
44
|
+
{
|
|
45
|
+
name: REGISTRATION_CLOSED_ENV,
|
|
46
|
+
required: false,
|
|
47
|
+
description: "Overrides the auth.registration_closed switch: true or 1 closes registration, false or 0 opens it.",
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
switches: [REGISTRATION_CLOSED_SWITCH],
|
|
51
|
+
routes: {
|
|
52
|
+
login: "/login",
|
|
53
|
+
register: "/register",
|
|
54
|
+
changePassword: "/account/password",
|
|
55
|
+
forgotPassword: "/forgot-password",
|
|
56
|
+
resetPassword: "/reset-password",
|
|
57
|
+
afterLogin: "/",
|
|
58
|
+
afterLogout: "/login",
|
|
59
|
+
},
|
|
60
|
+
mount: [
|
|
61
|
+
{ kind: "page", path: "app/login/page.tsx", export: "LoginPage" },
|
|
62
|
+
{ kind: "page", path: "app/register/page.tsx", export: "RegisterPage" },
|
|
63
|
+
{ kind: "page", path: "app/account/password/page.tsx", export: "ChangePasswordPage" },
|
|
64
|
+
{ kind: "page", path: "app/forgot-password/page.tsx", export: "ForgotPasswordPage" },
|
|
65
|
+
{ kind: "page", path: "app/reset-password/page.tsx", export: "ResetPasswordPage" },
|
|
66
|
+
{ kind: "route-handler", path: "app/api/auth/session/route.ts", export: "getSessionRoute" },
|
|
67
|
+
{ kind: "middleware", path: "proxy.ts", export: "createAuthGuard" },
|
|
68
|
+
],
|
|
69
|
+
privacy: { exports: true, deletes: true },
|
|
70
|
+
},
|
|
71
|
+
messages: authMessages,
|
|
72
|
+
options: authOptionsSchema,
|
|
73
|
+
migrations: { dir: resolveMigrationsDir(import.meta.url, "../migrations/") },
|
|
74
|
+
privacy: authPrivacyContributor,
|
|
75
|
+
health: checkAuthTables,
|
|
76
|
+
});
|
|
77
|
+
export { INITIAL_AUTH_FORM_STATE } from "./contract.js";
|
|
78
|
+
export { authMessages, getAuthErrorMessage } from "./messages/index.js";
|
|
79
|
+
export { consolePasswordResetSender } from "./password-reset-sender.js";
|
|
80
|
+
export { getSessionCookie } from "./session-cookie.js";
|
|
81
|
+
export { toSafeNextPath } from "./safe-next-path.js";
|
|
82
|
+
export { ADMIN_ROLE, ROLE_NAME_PATTERN } from "./roles.js";
|
|
83
|
+
export { passwordResets, sessions, userRoles, users } from "./schema.js";
|
|
84
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,qIAAqI;AACrI,4EAA4E;AAC5E,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC;AAEhC,2DAA2D;AAC3D,MAAM,CAAC,MAAM,0BAA0B,GAAG,0BAA0B,CAAC;AAErE;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,yCAAyC,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,CAAC,MAA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EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mailing/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,KAAK,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// The mailing adapter of @softure-ai/auth: password reset mails through `@softure-ai/mailing`
|
|
2
|
+
// (an optional peer dependency; only apps that import this entry need it).
|
|
3
|
+
export { mailingResetSender, renderPasswordResetMail } from "./reset-mail.js";
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mailing/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,2EAA2E;AAC3E,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAuD,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Locale } from "@softure-ai/core";
|
|
2
|
+
import type { OutgoingMail } from "@softure-ai/mailing";
|
|
3
|
+
import type { AuthMessages } from "../messages/index.js";
|
|
4
|
+
import type { PasswordResetSender } from "../password-reset-sender.js";
|
|
5
|
+
export interface PasswordResetMailInput {
|
|
6
|
+
/** The reset link auth hands to the sender. */
|
|
7
|
+
readonly link: string;
|
|
8
|
+
/** How long the link works (`passwordReset.ttlMinutes`). */
|
|
9
|
+
readonly ttlMinutes: number;
|
|
10
|
+
}
|
|
11
|
+
/** The subject and bodies of a reset mail, without the recipient. */
|
|
12
|
+
export type PasswordResetMail = Pick<OutgoingMail, "subject" | "text"> & {
|
|
13
|
+
readonly html: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Renders the reset mail from `messages` (one locale's dictionary, overrides applied): a plain-text
|
|
17
|
+
* body with the bare link and an HTML body with the same paragraphs and the link as an anchor.
|
|
18
|
+
*/
|
|
19
|
+
export declare function renderPasswordResetMail(messages: AuthMessages, locale: Locale, input: PasswordResetMailInput): PasswordResetMail;
|
|
20
|
+
/**
|
|
21
|
+
* A `passwordReset.send` that mails the link through `@softure-ai/mailing`:
|
|
22
|
+
* `auth({ passwordReset: { send: mailingResetSender() } })` next to `mailing({ ... })`. It reads the
|
|
23
|
+
* registered config (`registerSoftureConfig`) when it runs. A failed send throws an error naming
|
|
24
|
+
* the `mailing.*` code (never the address or the link), which auth logs.
|
|
25
|
+
*/
|
|
26
|
+
export declare function mailingResetSender(): PasswordResetSender;
|
|
27
|
+
//# sourceMappingURL=reset-mail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-mail.d.ts","sourceRoot":"","sources":["../../src/mailing/reset-mail.ts"],"names":[],"mappings":"AAGA,OAAO,EAA+B,KAAK,MAAM,EAAsB,MAAM,kBAAkB,CAAC;AAEhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGvE,MAAM,WAAW,sBAAsB;IACrC,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,qEAAqE;AACrE,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,MAAM,CAAC,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAQnG;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,GAAG,iBAAiB,CAehI;AAQD;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,mBAAmB,CAYxD"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// The password reset mail: rendered from auth's dictionaries in the app's locale and sent through
|
|
2
|
+
// `@softure-ai/mailing`. A transactional mail: no unsubscribe link, never suppressed. The link is
|
|
3
|
+
// placed by the code, never by a translatable string, so a copy override cannot drop it.
|
|
4
|
+
import { formatMessage, selectPlural } from "@softure-ai/core";
|
|
5
|
+
import { getSoftureConfig } from "@softure-ai/core/next";
|
|
6
|
+
import { sendMail } from "@softure-ai/mailing/server";
|
|
7
|
+
import { getAuthModule, getAuthOptions } from "../server/options.js";
|
|
8
|
+
const HTML_ESCAPES = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
9
|
+
function escapeHtml(value) {
|
|
10
|
+
return value.replace(/[&<>"']/g, (character) => HTML_ESCAPES[character] ?? character);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Renders the reset mail from `messages` (one locale's dictionary, overrides applied): a plain-text
|
|
14
|
+
* body with the bare link and an HTML body with the same paragraphs and the link as an anchor.
|
|
15
|
+
*/
|
|
16
|
+
export function renderPasswordResetMail(messages, locale, input) {
|
|
17
|
+
const copy = messages.resetMail;
|
|
18
|
+
const duration = formatMessage(selectPlural(locale, input.ttlMinutes, copy.minutes), { count: input.ttlMinutes });
|
|
19
|
+
const expiry = formatMessage(copy.expiry, { duration });
|
|
20
|
+
const text = [copy.greeting, copy.intro, input.link, expiry, copy.ignore].join("\n\n");
|
|
21
|
+
const paragraphs = [
|
|
22
|
+
escapeHtml(copy.greeting),
|
|
23
|
+
escapeHtml(copy.intro),
|
|
24
|
+
`<a href="${escapeHtml(input.link)}">${escapeHtml(copy.action)}</a>`,
|
|
25
|
+
escapeHtml(expiry),
|
|
26
|
+
escapeHtml(copy.ignore),
|
|
27
|
+
];
|
|
28
|
+
const html = paragraphs.map((paragraph) => `<p>${paragraph}</p>`).join("\n");
|
|
29
|
+
return { subject: copy.subject, text, html };
|
|
30
|
+
}
|
|
31
|
+
/** The app's auth dictionary for `locale`, with its overrides applied. */
|
|
32
|
+
function getMessages(config, locale) {
|
|
33
|
+
// The module factory merged the dictionaries; their shape is the module's own.
|
|
34
|
+
return getAuthModule(config).messages[locale];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A `passwordReset.send` that mails the link through `@softure-ai/mailing`:
|
|
38
|
+
* `auth({ passwordReset: { send: mailingResetSender() } })` next to `mailing({ ... })`. It reads the
|
|
39
|
+
* registered config (`registerSoftureConfig`) when it runs. A failed send throws an error naming
|
|
40
|
+
* the `mailing.*` code (never the address or the link), which auth logs.
|
|
41
|
+
*/
|
|
42
|
+
export function mailingResetSender() {
|
|
43
|
+
return async (link, user, details) => {
|
|
44
|
+
const config = getSoftureConfig();
|
|
45
|
+
const mail = renderPasswordResetMail(getMessages(config, details.locale), details.locale, {
|
|
46
|
+
link,
|
|
47
|
+
ttlMinutes: getAuthOptions(config).passwordReset.ttlMinutes,
|
|
48
|
+
});
|
|
49
|
+
const result = await sendMail({ config }, { to: user.email, ...mail });
|
|
50
|
+
if (!result.ok) {
|
|
51
|
+
throw new Error(`@softure-ai/auth: the password reset mail was not sent (${result.error})`);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=reset-mail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-mail.js","sourceRoot":"","sources":["../../src/mailing/reset-mail.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,kGAAkG;AAClG,yFAAyF;AACzF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAmC,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEz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
|
|
5
|
+
currentPassword: string;
|
|
6
|
+
newPassword: string;
|
|
7
|
+
newPasswordHint: string;
|
|
8
|
+
consent: string;
|
|
9
|
+
};
|
|
10
|
+
login: {
|
|
11
|
+
title: string;
|
|
12
|
+
lead: string;
|
|
13
|
+
submit: string;
|
|
14
|
+
pending: string;
|
|
15
|
+
noAccount: string;
|
|
16
|
+
registerLink: string;
|
|
17
|
+
forgotPassword: string;
|
|
18
|
+
};
|
|
19
|
+
register: {
|
|
20
|
+
title: string;
|
|
21
|
+
lead: string;
|
|
22
|
+
submit: string;
|
|
23
|
+
pending: string;
|
|
24
|
+
hasAccount: string;
|
|
25
|
+
loginLink: string;
|
|
26
|
+
closedTitle: string;
|
|
27
|
+
closedBody: string;
|
|
28
|
+
};
|
|
29
|
+
changePassword: {
|
|
30
|
+
title: string;
|
|
31
|
+
lead: string;
|
|
32
|
+
submit: string;
|
|
33
|
+
pending: string;
|
|
34
|
+
success: string;
|
|
35
|
+
};
|
|
36
|
+
forgotPassword: {
|
|
37
|
+
title: string;
|
|
38
|
+
lead: string;
|
|
39
|
+
submit: string;
|
|
40
|
+
pending: string;
|
|
41
|
+
sent: string;
|
|
42
|
+
backToLogin: string;
|
|
43
|
+
};
|
|
44
|
+
resetPassword: {
|
|
45
|
+
title: string;
|
|
46
|
+
lead: string;
|
|
47
|
+
submit: string;
|
|
48
|
+
pending: string;
|
|
49
|
+
success: string;
|
|
50
|
+
invalidTitle: string;
|
|
51
|
+
invalidBody: string;
|
|
52
|
+
requestNew: string;
|
|
53
|
+
};
|
|
54
|
+
resetMail: {
|
|
55
|
+
subject: string;
|
|
56
|
+
greeting: string;
|
|
57
|
+
intro: string;
|
|
58
|
+
action: string;
|
|
59
|
+
expiry: string;
|
|
60
|
+
/** `{count}` minutes, by the locale's plural rules (Intl.PluralRules categories). */
|
|
61
|
+
minutes: {
|
|
62
|
+
one: string;
|
|
63
|
+
few: string;
|
|
64
|
+
many: string;
|
|
65
|
+
other: string;
|
|
66
|
+
};
|
|
67
|
+
ignore: string;
|
|
68
|
+
};
|
|
69
|
+
logout: {
|
|
70
|
+
submit: string;
|
|
71
|
+
};
|
|
72
|
+
errors: {
|
|
73
|
+
auth: {
|
|
74
|
+
invalid_credentials: string;
|
|
75
|
+
email_invalid: string;
|
|
76
|
+
email_taken: string;
|
|
77
|
+
password_too_short: string;
|
|
78
|
+
password_too_long: string;
|
|
79
|
+
consent_required: string;
|
|
80
|
+
registration_closed: string;
|
|
81
|
+
current_password_invalid: string;
|
|
82
|
+
password_unchanged: string;
|
|
83
|
+
unauthenticated: string;
|
|
84
|
+
forbidden: string;
|
|
85
|
+
reset_token_invalid: string;
|
|
86
|
+
password_reset_unavailable: string;
|
|
87
|
+
};
|
|
88
|
+
security: {
|
|
89
|
+
rate_limited: string;
|
|
90
|
+
client_unidentified: string;
|
|
91
|
+
};
|
|
92
|
+
core: {
|
|
93
|
+
database_failed: string;
|
|
94
|
+
unexpected: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=en.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA2DX,qFAAqF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCxF,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export const en = {
|
|
2
|
+
fields: {
|
|
3
|
+
email: "Email",
|
|
4
|
+
password: "Password",
|
|
5
|
+
currentPassword: "Current password",
|
|
6
|
+
newPassword: "New password",
|
|
7
|
+
newPasswordHint: "At least {minLength} characters.",
|
|
8
|
+
consent: "I accept the terms of service and the privacy policy.",
|
|
9
|
+
},
|
|
10
|
+
login: {
|
|
11
|
+
title: "Log in",
|
|
12
|
+
lead: "Welcome back.",
|
|
13
|
+
submit: "Log in",
|
|
14
|
+
pending: "Logging in…",
|
|
15
|
+
noAccount: "No account yet?",
|
|
16
|
+
registerLink: "Create one",
|
|
17
|
+
forgotPassword: "Forgot your password?",
|
|
18
|
+
},
|
|
19
|
+
register: {
|
|
20
|
+
title: "Create an account",
|
|
21
|
+
lead: "It takes a minute.",
|
|
22
|
+
submit: "Create account",
|
|
23
|
+
pending: "Creating…",
|
|
24
|
+
hasAccount: "Already have an account?",
|
|
25
|
+
loginLink: "Log in",
|
|
26
|
+
closedTitle: "Registration is closed",
|
|
27
|
+
closedBody: "New accounts cannot be created right now. Try again later.",
|
|
28
|
+
},
|
|
29
|
+
changePassword: {
|
|
30
|
+
title: "Change password",
|
|
31
|
+
lead: "Every other device you are logged in on will be logged out.",
|
|
32
|
+
submit: "Change password",
|
|
33
|
+
pending: "Saving…",
|
|
34
|
+
success: "Your password has been changed.",
|
|
35
|
+
},
|
|
36
|
+
forgotPassword: {
|
|
37
|
+
title: "Reset your password",
|
|
38
|
+
lead: "Enter the email of your account and we will send you a link to set a new password.",
|
|
39
|
+
submit: "Send the link",
|
|
40
|
+
pending: "Sending…",
|
|
41
|
+
sent: "If an account uses this email, a link to reset its password is on its way. It works for {ttlMinutes} minutes.",
|
|
42
|
+
backToLogin: "Back to login",
|
|
43
|
+
},
|
|
44
|
+
resetPassword: {
|
|
45
|
+
title: "Set a new password",
|
|
46
|
+
lead: "You will be logged out on every device.",
|
|
47
|
+
submit: "Set password",
|
|
48
|
+
pending: "Saving…",
|
|
49
|
+
success: "Your password has been changed. Log in with the new one.",
|
|
50
|
+
invalidTitle: "This link does not work",
|
|
51
|
+
invalidBody: "The link has expired or has already been used. Ask for a new one.",
|
|
52
|
+
requestNew: "Get a new link",
|
|
53
|
+
},
|
|
54
|
+
resetMail: {
|
|
55
|
+
subject: "Reset your password",
|
|
56
|
+
greeting: "Hello,",
|
|
57
|
+
intro: "We got a request to reset the password of your account. Open this link to set a new one:",
|
|
58
|
+
action: "Set a new password",
|
|
59
|
+
expiry: "The link works for {duration} and only once.",
|
|
60
|
+
/** `{count}` minutes, by the locale's plural rules (Intl.PluralRules categories). */
|
|
61
|
+
minutes: { one: "{count} minute", few: "{count} minutes", many: "{count} minutes", other: "{count} minutes" },
|
|
62
|
+
ignore: "If you did not ask for this, ignore this mail: your password stays as it is.",
|
|
63
|
+
},
|
|
64
|
+
logout: {
|
|
65
|
+
submit: "Log out",
|
|
66
|
+
},
|
|
67
|
+
errors: {
|
|
68
|
+
auth: {
|
|
69
|
+
invalid_credentials: "The email or password is incorrect.",
|
|
70
|
+
email_invalid: "Enter a valid email address.",
|
|
71
|
+
email_taken: "An account with this email already exists.",
|
|
72
|
+
password_too_short: "The password is too short.",
|
|
73
|
+
password_too_long: "The password is too long.",
|
|
74
|
+
consent_required: "You need to accept the terms to create an account.",
|
|
75
|
+
registration_closed: "Registration is closed.",
|
|
76
|
+
current_password_invalid: "The current password is incorrect.",
|
|
77
|
+
password_unchanged: "The new password must differ from the current one.",
|
|
78
|
+
unauthenticated: "Your session has ended. Log in again.",
|
|
79
|
+
forbidden: "You do not have access to this.",
|
|
80
|
+
reset_token_invalid: "This link has expired or has already been used. Ask for a new one.",
|
|
81
|
+
password_reset_unavailable: "Password reset is not available.",
|
|
82
|
+
},
|
|
83
|
+
security: {
|
|
84
|
+
rate_limited: "Too many attempts. Wait a few minutes and try again.",
|
|
85
|
+
client_unidentified: "We could not verify where this request came from. Try again later.",
|
|
86
|
+
},
|
|
87
|
+
core: {
|
|
88
|
+
database_failed: "Something went wrong on our side. Try again in a moment.",
|
|
89
|
+
unexpected: "Something went wrong on our side. Try again in a moment.",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=en.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM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