@sylphx/auth-solid 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +56 -2
- package/dist/browser.js +1067 -0
- package/dist/index.d.ts +4 -0
- package/dist/locale.d.ts +6 -0
- package/dist/messages.d.ts +413 -0
- package/dist/provider-icons.d.ts +5 -0
- package/dist/server.js +1072 -0
- package/dist/sign-in-controller.d.ts +55 -0
- package/dist/sign-in.css +140 -0
- package/dist/sign-in.d.ts +29 -0
- package/package.json +53 -5
package/dist/server.js
ADDED
|
@@ -0,0 +1,1072 @@
|
|
|
1
|
+
import { createComponent, escape, memo, ssr, ssrAttribute, ssrHydrationKey, ssrStyle } from "solid-js/web";
|
|
2
|
+
import { providerDestination, providers, safeReturnTo } from "@sylphx/auth/client";
|
|
3
|
+
import { For, Match, Show, Switch, createMemo, createSignal, createUniqueId, onCleanup, onMount } from "solid-js";
|
|
4
|
+
// src/messages.ts
|
|
5
|
+
var catalogs = {
|
|
6
|
+
en: {
|
|
7
|
+
signIn: "Sign in",
|
|
8
|
+
enterPassword: "Enter your password",
|
|
9
|
+
createYourAccount: "Create your account",
|
|
10
|
+
checkInbox: "Check your inbox",
|
|
11
|
+
confirmEmail: "Confirm your email",
|
|
12
|
+
verifyIdentity: "Verify it’s you",
|
|
13
|
+
chooseMethod: "Choose how you’d like to sign in.",
|
|
14
|
+
startWithEmail: "Use your email to get started.",
|
|
15
|
+
checkEmailDescription: "If this address is new, we’ll send a confirmation link. Open it and enter the password you just chose.",
|
|
16
|
+
confirmEmailDescription: "Enter the email and password you used to sign up.",
|
|
17
|
+
enterEmailCode: (email) => `Enter the six-digit code sent to ${email}.`,
|
|
18
|
+
enterRecovery: "Enter one of your saved recovery codes.",
|
|
19
|
+
enterAuthenticator: "Enter the code from your authenticator app.",
|
|
20
|
+
loading: "Loading sign-in options…",
|
|
21
|
+
retry: "Try again",
|
|
22
|
+
openingProvider: (provider) => `Opening ${provider}…`,
|
|
23
|
+
continueProvider: (provider) => `Continue with ${provider}`,
|
|
24
|
+
orEmail: "or use email",
|
|
25
|
+
email: "Email address",
|
|
26
|
+
sendingCode: "Sending code…",
|
|
27
|
+
emailCodeAction: "Email me a code",
|
|
28
|
+
continueEmail: "Continue with email",
|
|
29
|
+
waitingPasskey: "Waiting for your passkey…",
|
|
30
|
+
usePasskey: "Use a passkey",
|
|
31
|
+
newHere: "New here?",
|
|
32
|
+
createAnAccount: "Create an account",
|
|
33
|
+
noMethods: "No sign-in methods are available right now.",
|
|
34
|
+
password: "Password",
|
|
35
|
+
hidePassword: "Hide password",
|
|
36
|
+
showPassword: "Show password",
|
|
37
|
+
hide: "Hide",
|
|
38
|
+
show: "Show",
|
|
39
|
+
minimumPassword: "Use at least 12 characters.",
|
|
40
|
+
working: "Working…",
|
|
41
|
+
createAccount: "Create account",
|
|
42
|
+
confirmAndSignIn: "Confirm and sign in",
|
|
43
|
+
changeEmailOrMethod: "Change email or sign-in method",
|
|
44
|
+
backToSignIn: "Back to sign in",
|
|
45
|
+
emailCode: "Email code",
|
|
46
|
+
checkingCode: "Checking code…",
|
|
47
|
+
verifyCode: "Verify code",
|
|
48
|
+
resendIn: (duration) => `Resend in ${duration}`,
|
|
49
|
+
resendCode: "Resend code",
|
|
50
|
+
changeEmail: "Change email",
|
|
51
|
+
usePassword: "Use password instead",
|
|
52
|
+
recoveryCode: "Recovery code",
|
|
53
|
+
authenticatorCode: "Authenticator code",
|
|
54
|
+
verifyAndSignIn: "Verify and sign in",
|
|
55
|
+
useAuthenticator: "Use authenticator app",
|
|
56
|
+
useRecovery: "Use a recovery code",
|
|
57
|
+
language: "Language",
|
|
58
|
+
errors: {
|
|
59
|
+
signin: "Sign-in didn’t finish. Try again or choose another way to sign in.",
|
|
60
|
+
cancelled: "Sign-in was canceled. You can try again whenever you’re ready.",
|
|
61
|
+
use_existing: "Try the method you originally used to sign in. This provider couldn’t confirm your email.",
|
|
62
|
+
invalid_credentials: "That email and password didn’t match. Check both and try again.",
|
|
63
|
+
verify_email: "Confirm your email from the link in your inbox before signing in.",
|
|
64
|
+
verification_failed: "This confirmation link couldn’t be used. Check that you opened the latest link.",
|
|
65
|
+
invalid_code: "That code didn’t work. Check it and try again.",
|
|
66
|
+
method_unavailable: "That sign-in method isn’t available right now. Try another one.",
|
|
67
|
+
signup_failed: "We couldn’t start your account. Check your details and try again.",
|
|
68
|
+
invalid_input: "Check your details and try again.",
|
|
69
|
+
try_later: "Too many attempts. Wait a moment before trying again.",
|
|
70
|
+
unavailable: "We couldn’t connect. Try again in a moment."
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"zh-Hant-HK": {
|
|
74
|
+
signIn: "登入",
|
|
75
|
+
enterPassword: "輸入密碼",
|
|
76
|
+
createYourAccount: "建立帳戶",
|
|
77
|
+
checkInbox: "查閱收件箱",
|
|
78
|
+
confirmEmail: "確認電郵地址",
|
|
79
|
+
verifyIdentity: "驗證身分",
|
|
80
|
+
chooseMethod: "請選擇登入方式。",
|
|
81
|
+
startWithEmail: "請輸入電郵地址以建立帳戶。",
|
|
82
|
+
checkEmailDescription: "如這個電郵地址尚未登記,我們會發出確認電郵。請開啟電郵內的連結,再輸入剛設定的密碼。",
|
|
83
|
+
confirmEmailDescription: "請輸入登記時使用的電郵地址及密碼。",
|
|
84
|
+
enterEmailCode: (email) => `請輸入發送至 ${email} 的六位數字驗證碼。`,
|
|
85
|
+
enterRecovery: "請輸入其中一個已儲存的復原碼。",
|
|
86
|
+
enterAuthenticator: "請輸入驗證器應用程式顯示的驗證碼。",
|
|
87
|
+
loading: "正在載入登入選項…",
|
|
88
|
+
retry: "再試一次",
|
|
89
|
+
openingProvider: (provider) => `正在開啟 ${provider}…`,
|
|
90
|
+
continueProvider: (provider) => `使用 ${provider} 登入`,
|
|
91
|
+
orEmail: "或使用電郵",
|
|
92
|
+
email: "電郵地址",
|
|
93
|
+
sendingCode: "正在發送驗證碼…",
|
|
94
|
+
emailCodeAction: "發送電郵驗證碼",
|
|
95
|
+
continueEmail: "使用電郵繼續",
|
|
96
|
+
waitingPasskey: "請在裝置上使用通行密鑰…",
|
|
97
|
+
usePasskey: "使用通行密鑰",
|
|
98
|
+
newHere: "未有帳戶?",
|
|
99
|
+
createAnAccount: "建立帳戶",
|
|
100
|
+
noMethods: "目前沒有可用的登入方式。",
|
|
101
|
+
password: "密碼",
|
|
102
|
+
hidePassword: "隱藏密碼",
|
|
103
|
+
showPassword: "顯示密碼",
|
|
104
|
+
hide: "隱藏",
|
|
105
|
+
show: "顯示",
|
|
106
|
+
minimumPassword: "密碼須至少有 12 個字元。",
|
|
107
|
+
working: "處理中…",
|
|
108
|
+
createAccount: "建立帳戶",
|
|
109
|
+
confirmAndSignIn: "確認並登入",
|
|
110
|
+
changeEmailOrMethod: "更改電郵地址或登入方式",
|
|
111
|
+
backToSignIn: "返回登入",
|
|
112
|
+
emailCode: "電郵驗證碼",
|
|
113
|
+
checkingCode: "正在核對驗證碼…",
|
|
114
|
+
verifyCode: "驗證",
|
|
115
|
+
resendIn: (duration) => `${duration}後可重發`,
|
|
116
|
+
resendCode: "重發驗證碼",
|
|
117
|
+
changeEmail: "更改電郵地址",
|
|
118
|
+
usePassword: "改用密碼",
|
|
119
|
+
recoveryCode: "復原碼",
|
|
120
|
+
authenticatorCode: "驗證器驗證碼",
|
|
121
|
+
verifyAndSignIn: "驗證並登入",
|
|
122
|
+
useAuthenticator: "使用驗證器",
|
|
123
|
+
useRecovery: "使用復原碼",
|
|
124
|
+
language: "語言",
|
|
125
|
+
errors: {
|
|
126
|
+
signin: "未能完成登入。請再試一次,或選擇其他登入方式。",
|
|
127
|
+
cancelled: "登入已取消。你可以隨時再試。",
|
|
128
|
+
use_existing: "這項登入服務未能確認你的電郵地址。請改用原來的登入方式。",
|
|
129
|
+
invalid_credentials: "電郵地址與密碼不符。請核對後再試。",
|
|
130
|
+
verify_email: "請先開啟確認電郵內的連結,確認電郵地址後再登入。",
|
|
131
|
+
verification_failed: "此連結無法使用。請開啟最新一封確認電郵內的連結。",
|
|
132
|
+
invalid_code: "驗證碼無法使用。請核對後再試。",
|
|
133
|
+
method_unavailable: "暫時無法使用此登入方式。請選擇其他方式。",
|
|
134
|
+
signup_failed: "未能建立帳戶。請核對資料後再試。",
|
|
135
|
+
invalid_input: "請核對資料後再試。",
|
|
136
|
+
try_later: "嘗試次數過多。請稍候再試。",
|
|
137
|
+
unavailable: "未能連線。請稍後再試。"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"zh-Hant-TW": {
|
|
141
|
+
signIn: "登入",
|
|
142
|
+
enterPassword: "輸入密碼",
|
|
143
|
+
createYourAccount: "建立帳號",
|
|
144
|
+
checkInbox: "查看收件匣",
|
|
145
|
+
confirmEmail: "確認電子郵件地址",
|
|
146
|
+
verifyIdentity: "驗證身分",
|
|
147
|
+
chooseMethod: "請選擇登入方式。",
|
|
148
|
+
startWithEmail: "請先輸入電子郵件地址。",
|
|
149
|
+
checkEmailDescription: "如果這個電子郵件地址還沒註冊,我們會寄出確認信。請開啟信中的連結,再輸入剛設定的密碼。",
|
|
150
|
+
confirmEmailDescription: "請輸入註冊時使用的電子郵件地址和密碼。",
|
|
151
|
+
enterEmailCode: (email) => `請輸入寄到 ${email} 的 6 位數驗證碼。`,
|
|
152
|
+
enterRecovery: "請輸入一組已儲存的復原碼。",
|
|
153
|
+
enterAuthenticator: "請輸入驗證器應用程式顯示的驗證碼。",
|
|
154
|
+
loading: "正在載入登入選項…",
|
|
155
|
+
retry: "再試一次",
|
|
156
|
+
openingProvider: (provider) => `正在開啟 ${provider}…`,
|
|
157
|
+
continueProvider: (provider) => `使用 ${provider} 登入`,
|
|
158
|
+
orEmail: "或使用電子郵件",
|
|
159
|
+
email: "電子郵件地址",
|
|
160
|
+
sendingCode: "正在寄送驗證碼…",
|
|
161
|
+
emailCodeAction: "寄送驗證碼",
|
|
162
|
+
continueEmail: "以電子郵件繼續",
|
|
163
|
+
waitingPasskey: "請在裝置上使用通行金鑰…",
|
|
164
|
+
usePasskey: "使用通行金鑰",
|
|
165
|
+
newHere: "還沒有帳號?",
|
|
166
|
+
createAnAccount: "建立帳號",
|
|
167
|
+
noMethods: "目前沒有可用的登入方式。",
|
|
168
|
+
password: "密碼",
|
|
169
|
+
hidePassword: "隱藏密碼",
|
|
170
|
+
showPassword: "顯示密碼",
|
|
171
|
+
hide: "隱藏",
|
|
172
|
+
show: "顯示",
|
|
173
|
+
minimumPassword: "密碼至少需要 12 個字元。",
|
|
174
|
+
working: "處理中…",
|
|
175
|
+
createAccount: "建立帳號",
|
|
176
|
+
confirmAndSignIn: "確認並登入",
|
|
177
|
+
changeEmailOrMethod: "變更電子郵件或登入方式",
|
|
178
|
+
backToSignIn: "返回登入頁",
|
|
179
|
+
emailCode: "電子郵件驗證碼",
|
|
180
|
+
checkingCode: "正在檢查驗證碼…",
|
|
181
|
+
verifyCode: "驗證",
|
|
182
|
+
resendIn: (duration) => `${duration}後可重寄`,
|
|
183
|
+
resendCode: "重寄驗證碼",
|
|
184
|
+
changeEmail: "變更電子郵件",
|
|
185
|
+
usePassword: "改用密碼",
|
|
186
|
+
recoveryCode: "復原碼",
|
|
187
|
+
authenticatorCode: "驗證器驗證碼",
|
|
188
|
+
verifyAndSignIn: "驗證並登入",
|
|
189
|
+
useAuthenticator: "使用驗證器",
|
|
190
|
+
useRecovery: "使用復原碼",
|
|
191
|
+
language: "語言",
|
|
192
|
+
errors: {
|
|
193
|
+
signin: "無法完成登入。請再試一次,或改用其他方式登入。",
|
|
194
|
+
cancelled: "登入已取消。你可以隨時再試。",
|
|
195
|
+
use_existing: "這項登入服務無法確認你的電子郵件地址。請改用原本的登入方式。",
|
|
196
|
+
invalid_credentials: "電子郵件地址和密碼不符。請檢查後再試一次。",
|
|
197
|
+
verify_email: "請先開啟確認信中的連結,確認電子郵件地址後再登入。",
|
|
198
|
+
verification_failed: "這個確認連結無法使用。請確認你開啟的是最新一封確認信中的連結。",
|
|
199
|
+
invalid_code: "這組驗證碼無法使用。請檢查後再試一次。",
|
|
200
|
+
method_unavailable: "這個登入方式目前無法使用。請改用其他方式。",
|
|
201
|
+
signup_failed: "無法建立帳號。請檢查輸入的資料後再試一次。",
|
|
202
|
+
invalid_input: "請檢查輸入的資料後再試一次。",
|
|
203
|
+
try_later: "嘗試次數過多。請稍後再試。",
|
|
204
|
+
unavailable: "目前無法連線。請稍後再試。"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"zh-Hans": {
|
|
208
|
+
signIn: "登录",
|
|
209
|
+
enterPassword: "输入密码",
|
|
210
|
+
createYourAccount: "创建账号",
|
|
211
|
+
checkInbox: "查看收件箱",
|
|
212
|
+
confirmEmail: "确认邮箱地址",
|
|
213
|
+
verifyIdentity: "验证身份",
|
|
214
|
+
chooseMethod: "请选择登录方式。",
|
|
215
|
+
startWithEmail: "请先输入邮箱地址。",
|
|
216
|
+
checkEmailDescription: "如果此邮箱地址尚未注册,我们会发送一封确认邮件。请打开邮件中的链接,再输入刚设置的密码。",
|
|
217
|
+
confirmEmailDescription: "请输入注册时使用的邮箱地址和密码。",
|
|
218
|
+
enterEmailCode: (email) => `请输入发送到 ${email} 的 6 位数字验证码。`,
|
|
219
|
+
enterRecovery: "请输入一个已保存的恢复代码。",
|
|
220
|
+
enterAuthenticator: "请输入验证器应用中的验证码。",
|
|
221
|
+
loading: "正在加载登录选项…",
|
|
222
|
+
retry: "重试",
|
|
223
|
+
openingProvider: (provider) => `正在打开 ${provider}…`,
|
|
224
|
+
continueProvider: (provider) => `使用 ${provider} 登录`,
|
|
225
|
+
orEmail: "或使用邮箱",
|
|
226
|
+
email: "邮箱地址",
|
|
227
|
+
sendingCode: "正在发送验证码…",
|
|
228
|
+
emailCodeAction: "发送邮箱验证码",
|
|
229
|
+
continueEmail: "使用邮箱继续",
|
|
230
|
+
waitingPasskey: "请在设备上使用通行密钥…",
|
|
231
|
+
usePasskey: "使用通行密钥",
|
|
232
|
+
newHere: "还没有账号?",
|
|
233
|
+
createAnAccount: "创建账号",
|
|
234
|
+
noMethods: "当前没有可用的登录方式。",
|
|
235
|
+
password: "密码",
|
|
236
|
+
hidePassword: "隐藏密码",
|
|
237
|
+
showPassword: "显示密码",
|
|
238
|
+
hide: "隐藏",
|
|
239
|
+
show: "显示",
|
|
240
|
+
minimumPassword: "密码至少需要 12 个字符。",
|
|
241
|
+
working: "处理中…",
|
|
242
|
+
createAccount: "创建账号",
|
|
243
|
+
confirmAndSignIn: "确认并登录",
|
|
244
|
+
changeEmailOrMethod: "更改邮箱或登录方式",
|
|
245
|
+
backToSignIn: "返回登录",
|
|
246
|
+
emailCode: "邮箱验证码",
|
|
247
|
+
checkingCode: "正在核对验证码…",
|
|
248
|
+
verifyCode: "验证",
|
|
249
|
+
resendIn: (duration) => `${duration}后可重新发送`,
|
|
250
|
+
resendCode: "重新发送验证码",
|
|
251
|
+
changeEmail: "更改邮箱",
|
|
252
|
+
usePassword: "改用密码",
|
|
253
|
+
recoveryCode: "恢复代码",
|
|
254
|
+
authenticatorCode: "验证器验证码",
|
|
255
|
+
verifyAndSignIn: "验证并登录",
|
|
256
|
+
useAuthenticator: "使用验证器",
|
|
257
|
+
useRecovery: "使用恢复代码",
|
|
258
|
+
language: "语言",
|
|
259
|
+
errors: {
|
|
260
|
+
signin: "未能完成登录。请重试,或选择其他登录方式。",
|
|
261
|
+
cancelled: "登录已取消。你可以随时重试。",
|
|
262
|
+
use_existing: "此登录服务无法确认你的邮箱地址。请改用原来的登录方式。",
|
|
263
|
+
invalid_credentials: "邮箱地址和密码不匹配。请检查后重试。",
|
|
264
|
+
verify_email: "请先打开确认邮件中的链接,确认邮箱地址后再登录。",
|
|
265
|
+
verification_failed: "此链接无法使用。请打开最新一封确认邮件中的链接。",
|
|
266
|
+
invalid_code: "此验证码无法使用。请检查后重试。",
|
|
267
|
+
method_unavailable: "此登录方式暂不可用,请改用其他方式。",
|
|
268
|
+
signup_failed: "无法创建账号。请检查填写的信息后重试。",
|
|
269
|
+
invalid_input: "请检查填写的信息后重试。",
|
|
270
|
+
try_later: "尝试次数过多。请稍后重试。",
|
|
271
|
+
unavailable: "暂时无法连接,请稍后再试。"
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
ja: {
|
|
275
|
+
signIn: "ログイン",
|
|
276
|
+
enterPassword: "パスワードを入力",
|
|
277
|
+
createYourAccount: "アカウントを作成",
|
|
278
|
+
checkInbox: "受信トレイを確認",
|
|
279
|
+
confirmEmail: "メールアドレスを確認",
|
|
280
|
+
verifyIdentity: "本人確認",
|
|
281
|
+
chooseMethod: "ログイン方法を選んでください。",
|
|
282
|
+
startWithEmail: "まず、メールアドレスを入力してください。",
|
|
283
|
+
checkEmailDescription: "このメールアドレスが未登録の場合は、確認メールを送信します。メール内のリンクを開き、設定したパスワードを入力してください。",
|
|
284
|
+
confirmEmailDescription: "登録時のメールアドレスとパスワードを入力してください。",
|
|
285
|
+
enterEmailCode: (email) => `${email} に送信した6桁のコードを入力してください。`,
|
|
286
|
+
enterRecovery: "保存してあるリカバリーコードを1つ入力してください。",
|
|
287
|
+
enterAuthenticator: "認証アプリに表示されたコードを入力してください。",
|
|
288
|
+
loading: "ログイン方法を読み込み中…",
|
|
289
|
+
retry: "もう一度試す",
|
|
290
|
+
openingProvider: (provider) => `${provider} を開いています…`,
|
|
291
|
+
continueProvider: (provider) => `${provider} でログイン`,
|
|
292
|
+
orEmail: "またはメールアドレスを使用",
|
|
293
|
+
email: "メールアドレス",
|
|
294
|
+
sendingCode: "コードを送信中…",
|
|
295
|
+
emailCodeAction: "コードをメールで受け取る",
|
|
296
|
+
continueEmail: "メールアドレスで続ける",
|
|
297
|
+
waitingPasskey: "端末でパスキーを使ってください…",
|
|
298
|
+
usePasskey: "パスキーを使う",
|
|
299
|
+
newHere: "アカウントをお持ちでない方",
|
|
300
|
+
createAnAccount: "新規登録",
|
|
301
|
+
noMethods: "現在利用できるログイン方法はありません。",
|
|
302
|
+
password: "パスワード",
|
|
303
|
+
hidePassword: "パスワードを非表示にする",
|
|
304
|
+
showPassword: "パスワードを表示",
|
|
305
|
+
hide: "非表示",
|
|
306
|
+
show: "表示",
|
|
307
|
+
minimumPassword: "パスワードは12文字以上にしてください。",
|
|
308
|
+
working: "処理中…",
|
|
309
|
+
createAccount: "アカウントを作成",
|
|
310
|
+
confirmAndSignIn: "確認してログイン",
|
|
311
|
+
changeEmailOrMethod: "メールアドレスやログイン方法を変更",
|
|
312
|
+
backToSignIn: "ログインに戻る",
|
|
313
|
+
emailCode: "メールの確認コード",
|
|
314
|
+
checkingCode: "コードを確認中…",
|
|
315
|
+
verifyCode: "コードを確認",
|
|
316
|
+
resendIn: (duration) => `再送信まであと${duration}`,
|
|
317
|
+
resendCode: "コードを再送信",
|
|
318
|
+
changeEmail: "メールアドレスを変更",
|
|
319
|
+
usePassword: "パスワードを使う",
|
|
320
|
+
recoveryCode: "リカバリーコード",
|
|
321
|
+
authenticatorCode: "認証アプリのコード",
|
|
322
|
+
verifyAndSignIn: "認証してログイン",
|
|
323
|
+
useAuthenticator: "認証アプリを使う",
|
|
324
|
+
useRecovery: "リカバリーコードを使う",
|
|
325
|
+
language: "言語",
|
|
326
|
+
errors: {
|
|
327
|
+
signin: "ログインを完了できませんでした。もう一度試すか、別のログイン方法をお選びください。",
|
|
328
|
+
cancelled: "ログインがキャンセルされました。いつでもやり直せます。",
|
|
329
|
+
use_existing: "このサービスではメールアドレスを確認できませんでした。最初に使った方法でログインしてください。",
|
|
330
|
+
invalid_credentials: "メールアドレスとパスワードが一致しません。両方を確認して、もう一度お試しください。",
|
|
331
|
+
verify_email: "確認メール内のリンクを開き、メールアドレスを確認してからログインしてください。",
|
|
332
|
+
verification_failed: "この確認リンクは使えません。最新の確認メールのリンクをお試しください。",
|
|
333
|
+
invalid_code: "このコードは使えません。入力内容を確認して、もう一度お試しください。",
|
|
334
|
+
method_unavailable: "現在この方法ではログインできません。別のログイン方法をお選びください。",
|
|
335
|
+
signup_failed: "アカウントを作成できませんでした。入力内容を確認して、もう一度お試しください。",
|
|
336
|
+
invalid_input: "入力内容を確認して、もう一度お試しください。",
|
|
337
|
+
try_later: "試行回数が上限に達しました。しばらく待ってからお試しください。",
|
|
338
|
+
unavailable: "接続できませんでした。しばらく待ってからお試しください。"
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
var localeNames = {
|
|
343
|
+
en: "English",
|
|
344
|
+
"zh-Hant-HK": "繁體中文(香港)",
|
|
345
|
+
"zh-Hant-TW": "繁體中文(台灣)",
|
|
346
|
+
"zh-Hans": "简体中文",
|
|
347
|
+
ja: "日本語"
|
|
348
|
+
};
|
|
349
|
+
/** Select a shipped language without comparing raw locale strings or relying on the host's locale. */
|
|
350
|
+
function resolveAuthLocale(preferences) {
|
|
351
|
+
for (const preference of preferences) {
|
|
352
|
+
let locale;
|
|
353
|
+
try {
|
|
354
|
+
locale = new Intl.Locale(preference);
|
|
355
|
+
} catch {
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
if (Object.hasOwn(catalogs, locale.baseName)) return locale.baseName;
|
|
359
|
+
if (locale.language === "en" || locale.language === "ja") return locale.language;
|
|
360
|
+
if (locale.language === "zh") {
|
|
361
|
+
const script = locale.maximize().script;
|
|
362
|
+
if (script === "Hans") return "zh-Hans";
|
|
363
|
+
if (script === "Hant") return /^(HK|MO)$/.test(locale.region ?? "") ? "zh-Hant-HK" : "zh-Hant-TW";
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return "en";
|
|
367
|
+
}
|
|
368
|
+
/** Format a countdown without assuming digit shapes, spacing or translated unit order. */
|
|
369
|
+
function authSecondsFormat(locale) {
|
|
370
|
+
return new Intl.NumberFormat(locale, {
|
|
371
|
+
style: "unit",
|
|
372
|
+
unit: "second",
|
|
373
|
+
unitDisplay: "short"
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
// src/provider-icons.tsx
|
|
377
|
+
var _tmpl$$1 = ["<svg", " aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"currentColor\" width=\"19\" height=\"19\"><path d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z\" fill=\"#4285F4\"></path><path d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z\" fill=\"#34A853\"></path><path d=\"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z\" fill=\"#FBBC05\"></path><path d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z\" fill=\"#EA4335\"></path></svg>"];
|
|
378
|
+
var _tmpl$2$1 = ["<svg", " aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"currentColor\" width=\"19\" height=\"19\"><path d=\"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z\"></path></svg>"];
|
|
379
|
+
var _tmpl$3$1 = ["<svg", " aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"currentColor\" width=\"19\" height=\"19\"><path d=\"M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701\"></path></svg>"];
|
|
380
|
+
var _tmpl$4$1 = ["<svg", " aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"currentColor\" width=\"19\" height=\"19\"><path d=\"M0 0h11.377v11.372H0zm12.623 0H24v11.372H12.623zM0 12.623h11.377V24H0zm12.623 0H24V24H12.623\" fill=\"#00A4EF\"></path></svg>"];
|
|
381
|
+
var _tmpl$5$1 = ["<svg", " aria-hidden=\"true\" viewBox=\"0 0 24 24\" fill=\"currentColor\" width=\"19\" height=\"19\"><path d=\"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z\"></path></svg>"];
|
|
382
|
+
function GoogleIcon() {
|
|
383
|
+
return ssr(_tmpl$$1, ssrHydrationKey());
|
|
384
|
+
}
|
|
385
|
+
function GitHubIcon() {
|
|
386
|
+
return ssr(_tmpl$2$1, ssrHydrationKey());
|
|
387
|
+
}
|
|
388
|
+
function AppleIcon() {
|
|
389
|
+
return ssr(_tmpl$3$1, ssrHydrationKey());
|
|
390
|
+
}
|
|
391
|
+
function MicrosoftIcon() {
|
|
392
|
+
return ssr(_tmpl$4$1, ssrHydrationKey());
|
|
393
|
+
}
|
|
394
|
+
function FacebookIcon() {
|
|
395
|
+
return ssr(_tmpl$5$1, ssrHydrationKey());
|
|
396
|
+
}
|
|
397
|
+
// src/sign-in-controller.ts
|
|
398
|
+
var errors = catalogs.en.errors;
|
|
399
|
+
errors.unavailable;
|
|
400
|
+
function isErrorCode(value) {
|
|
401
|
+
return typeof value === "string" && Object.hasOwn(errors, value);
|
|
402
|
+
}
|
|
403
|
+
var SignInError = class extends Error {
|
|
404
|
+
code;
|
|
405
|
+
constructor(code) {
|
|
406
|
+
super(code);
|
|
407
|
+
this.code = code;
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
function decode(value) {
|
|
411
|
+
return Uint8Array.from(atob(value.replace(/-/g, "+").replace(/_/g, "/")), (c) => c.charCodeAt(0));
|
|
412
|
+
}
|
|
413
|
+
function encode(value) {
|
|
414
|
+
return btoa(String.fromCharCode(...new Uint8Array(value))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
415
|
+
}
|
|
416
|
+
/** Create under a Solid owner. Requests start on mount and abort on cleanup. */
|
|
417
|
+
function createSignInController(options) {
|
|
418
|
+
const search = new URLSearchParams(options.search);
|
|
419
|
+
const next = safeReturnTo(options.next);
|
|
420
|
+
const loginPath = safeReturnTo(options.loginPath, "/login").split(/[?#]/, 1)[0];
|
|
421
|
+
const challengeId = search.get("challenge_id");
|
|
422
|
+
const verification = search.get("token");
|
|
423
|
+
const hasVerification = !!challengeId && !!verification && search.get("type") === "email_verification";
|
|
424
|
+
const [config, setConfig] = createSignal();
|
|
425
|
+
const [configFailed, setConfigFailed] = createSignal(false);
|
|
426
|
+
const [step, setStep] = createSignal("choose");
|
|
427
|
+
const [email, setEmail] = createSignal("");
|
|
428
|
+
const initialError = search.get("error");
|
|
429
|
+
const [errorCode, setErrorCode] = createSignal(isErrorCode(initialError) ? initialError : "");
|
|
430
|
+
const error = () => {
|
|
431
|
+
const value = errorCode();
|
|
432
|
+
return value ? errors[value] : "";
|
|
433
|
+
};
|
|
434
|
+
const [busy, setBusy] = createSignal("");
|
|
435
|
+
const [showPassword, setShowPassword] = createSignal(false);
|
|
436
|
+
const [canPasskey, setCanPasskey] = createSignal(false);
|
|
437
|
+
const [code, setCode] = createSignal("");
|
|
438
|
+
const [flow, setFlow] = createSignal("");
|
|
439
|
+
const [challenge, setChallenge] = createSignal("");
|
|
440
|
+
const [confirmAfterMfa, setConfirmAfterMfa] = createSignal(false);
|
|
441
|
+
const [recovery, setRecovery] = createSignal(false);
|
|
442
|
+
const [resendAt, setResendAt] = createSignal(0);
|
|
443
|
+
const [now, setNow] = createSignal(0);
|
|
444
|
+
const wait = () => Math.max(0, Math.ceil((resendAt() - now()) / 1e3));
|
|
445
|
+
let confController;
|
|
446
|
+
const controller = new AbortController();
|
|
447
|
+
async function loadConfig() {
|
|
448
|
+
if (controller.signal.aborted) return;
|
|
449
|
+
setConfigFailed(false);
|
|
450
|
+
setConfig(void 0);
|
|
451
|
+
confController?.abort();
|
|
452
|
+
const attempt = new AbortController();
|
|
453
|
+
confController = attempt;
|
|
454
|
+
try {
|
|
455
|
+
const res = await fetch("/auth/config", {
|
|
456
|
+
referrerPolicy: "origin",
|
|
457
|
+
redirect: "error",
|
|
458
|
+
signal: AbortSignal.any([attempt.signal, AbortSignal.timeout(12e3)])
|
|
459
|
+
});
|
|
460
|
+
if (!res.ok) throw new Error();
|
|
461
|
+
const data = await res.json();
|
|
462
|
+
if (!data || !Array.isArray(data.providers) || !data.providers.every((id) => typeof id === "string" && Object.hasOwn(providers, id)) || [
|
|
463
|
+
data.password,
|
|
464
|
+
data.signup,
|
|
465
|
+
data.otp,
|
|
466
|
+
data.passkey
|
|
467
|
+
].some((value) => typeof value !== "boolean")) throw new Error();
|
|
468
|
+
if (!attempt.signal.aborted) setConfig(data);
|
|
469
|
+
} catch {
|
|
470
|
+
if (!attempt.signal.aborted && !controller.signal.aborted) setConfigFailed(true);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
onMount(() => {
|
|
474
|
+
setCanPasskey(window.isSecureContext && typeof PublicKeyCredential !== "undefined");
|
|
475
|
+
if (hasVerification) {
|
|
476
|
+
setStep("confirm");
|
|
477
|
+
window.history.replaceState(window.history.state, "", `${loginPath}?${new URLSearchParams({ next })}`);
|
|
478
|
+
}
|
|
479
|
+
loadConfig();
|
|
480
|
+
const timer = window.setInterval(() => setNow(Date.now()), 1e3);
|
|
481
|
+
onCleanup(() => {
|
|
482
|
+
window.clearInterval(timer);
|
|
483
|
+
confController?.abort();
|
|
484
|
+
controller.abort();
|
|
485
|
+
});
|
|
486
|
+
});
|
|
487
|
+
function go(to) {
|
|
488
|
+
setErrorCode("");
|
|
489
|
+
setShowPassword(false);
|
|
490
|
+
setStep(to);
|
|
491
|
+
}
|
|
492
|
+
async function post(path, body) {
|
|
493
|
+
const res = await fetch(path, {
|
|
494
|
+
method: "POST",
|
|
495
|
+
headers: { "Content-Type": "application/json" },
|
|
496
|
+
referrerPolicy: "origin",
|
|
497
|
+
redirect: "error",
|
|
498
|
+
signal: AbortSignal.any([controller.signal, AbortSignal.timeout(45e3)]),
|
|
499
|
+
body: JSON.stringify(body)
|
|
500
|
+
});
|
|
501
|
+
const data = await res.json();
|
|
502
|
+
if (!res.ok) throw new SignInError(isErrorCode(data.error) ? data.error : "unavailable");
|
|
503
|
+
return data;
|
|
504
|
+
}
|
|
505
|
+
async function request(action, fields = {}) {
|
|
506
|
+
const data = await post("/auth/email", {
|
|
507
|
+
action,
|
|
508
|
+
next,
|
|
509
|
+
...fields
|
|
510
|
+
});
|
|
511
|
+
if (!controller.signal.aborted && typeof data.next === "string") window.location.assign(safeReturnTo(data.next, next));
|
|
512
|
+
return data;
|
|
513
|
+
}
|
|
514
|
+
async function run(label, op) {
|
|
515
|
+
if (busy() || controller.signal.aborted) return;
|
|
516
|
+
setBusy(label);
|
|
517
|
+
setErrorCode("");
|
|
518
|
+
try {
|
|
519
|
+
await op();
|
|
520
|
+
} catch (cause) {
|
|
521
|
+
if (!controller.signal.aborted) setErrorCode(cause instanceof SignInError ? cause.code : "unavailable");
|
|
522
|
+
} finally {
|
|
523
|
+
setBusy("");
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
function social(provider) {
|
|
527
|
+
if (!config()?.providers.includes(provider)) return;
|
|
528
|
+
return run(providers[provider][0], async () => {
|
|
529
|
+
const { authorize } = await post(`/auth/start/${provider}`, { next });
|
|
530
|
+
const target = providerDestination(provider, authorize);
|
|
531
|
+
if (!target) throw new Error();
|
|
532
|
+
if (!controller.signal.aborted) window.location.assign(target);
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
function sendCode() {
|
|
536
|
+
if (!config()?.otp || step() === "otp" && wait() > 0) return;
|
|
537
|
+
return run("email", async () => {
|
|
538
|
+
const data = await request("otp_start", { email: email().trim() });
|
|
539
|
+
if (!data.flow) throw new Error();
|
|
540
|
+
setFlow(data.flow);
|
|
541
|
+
setCode("");
|
|
542
|
+
const sentAt = Date.now();
|
|
543
|
+
setNow(sentAt);
|
|
544
|
+
setResendAt(sentAt + 3e4);
|
|
545
|
+
go("otp");
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
function verifyCode(value = code()) {
|
|
549
|
+
if (step() !== "otp" || busy() || !/^\d{6}$/.test(value)) return;
|
|
550
|
+
setCode(value);
|
|
551
|
+
return run("verify", async () => {
|
|
552
|
+
if ((await request("otp_verify", {
|
|
553
|
+
flow: flow(),
|
|
554
|
+
code: value
|
|
555
|
+
})).step === "mfa") {
|
|
556
|
+
setChallenge("");
|
|
557
|
+
setRecovery(false);
|
|
558
|
+
go("mfa");
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
function passkey() {
|
|
563
|
+
if (!canPasskey() || !config()?.passkey) return;
|
|
564
|
+
return run("passkey", async () => {
|
|
565
|
+
const { challenge, challengeId, rpId, credentials } = await request("passkey_start");
|
|
566
|
+
if (!challenge || !challengeId || !rpId || !credentials) throw new Error();
|
|
567
|
+
const assertion = await navigator.credentials.get({
|
|
568
|
+
signal: controller.signal,
|
|
569
|
+
publicKey: {
|
|
570
|
+
challenge: decode(challenge),
|
|
571
|
+
rpId,
|
|
572
|
+
timeout: 6e4,
|
|
573
|
+
userVerification: "required",
|
|
574
|
+
allowCredentials: credentials.map((id) => ({
|
|
575
|
+
id: decode(id),
|
|
576
|
+
type: "public-key"
|
|
577
|
+
}))
|
|
578
|
+
}
|
|
579
|
+
}).catch((error) => {
|
|
580
|
+
if (error instanceof DOMException && error.name === "NotAllowedError") return null;
|
|
581
|
+
throw error;
|
|
582
|
+
});
|
|
583
|
+
if (!(assertion instanceof PublicKeyCredential) || !(assertion.response instanceof AuthenticatorAssertionResponse)) throw new SignInError("method_unavailable");
|
|
584
|
+
const response = assertion.response;
|
|
585
|
+
await request("passkey_verify", {
|
|
586
|
+
challenge_id: challengeId,
|
|
587
|
+
credential_id: encode(assertion.rawId),
|
|
588
|
+
client_data_json: encode(response.clientDataJSON),
|
|
589
|
+
authenticator_data: encode(response.authenticatorData),
|
|
590
|
+
signature: encode(response.signature),
|
|
591
|
+
user_handle: response.userHandle ? encode(response.userHandle) : ""
|
|
592
|
+
});
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
function continueWithEmail() {
|
|
596
|
+
if (config()?.otp) return sendCode();
|
|
597
|
+
if (config()?.password && !busy()) go("password");
|
|
598
|
+
}
|
|
599
|
+
function submitPassword(password) {
|
|
600
|
+
const mode = step();
|
|
601
|
+
if (mode !== "password" && mode !== "signup" && mode !== "confirm") return;
|
|
602
|
+
if (mode === "confirm" && !hasVerification) return;
|
|
603
|
+
return run("password", async () => {
|
|
604
|
+
const data = await request(mode === "confirm" ? "verify_signup" : mode, {
|
|
605
|
+
email: email().trim(),
|
|
606
|
+
password,
|
|
607
|
+
...mode === "confirm" ? {
|
|
608
|
+
challengeId,
|
|
609
|
+
verification
|
|
610
|
+
} : {}
|
|
611
|
+
});
|
|
612
|
+
if (data.step === "check_email") go("check_email");
|
|
613
|
+
if (data.step === "mfa" && data.challenge) {
|
|
614
|
+
setChallenge(data.challenge);
|
|
615
|
+
setConfirmAfterMfa(mode === "confirm");
|
|
616
|
+
setRecovery(false);
|
|
617
|
+
go("mfa");
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
function submitMfa(value) {
|
|
622
|
+
if (step() !== "mfa") return;
|
|
623
|
+
const factor = value.trim();
|
|
624
|
+
const method = recovery() ? "recovery_code" : "totp";
|
|
625
|
+
return run("verify", async () => {
|
|
626
|
+
if (challenge()) await request("mfa", {
|
|
627
|
+
challenge: challenge(),
|
|
628
|
+
code: factor,
|
|
629
|
+
method,
|
|
630
|
+
...confirmAfterMfa() ? {
|
|
631
|
+
challengeId,
|
|
632
|
+
verification
|
|
633
|
+
} : {}
|
|
634
|
+
});
|
|
635
|
+
else await request("otp_verify", {
|
|
636
|
+
flow: flow(),
|
|
637
|
+
code: code(),
|
|
638
|
+
factor,
|
|
639
|
+
method
|
|
640
|
+
});
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
return {
|
|
644
|
+
config,
|
|
645
|
+
configFailed,
|
|
646
|
+
loadConfig,
|
|
647
|
+
step,
|
|
648
|
+
go,
|
|
649
|
+
email,
|
|
650
|
+
setEmail,
|
|
651
|
+
error,
|
|
652
|
+
errorCode,
|
|
653
|
+
busy,
|
|
654
|
+
showPassword,
|
|
655
|
+
setShowPassword,
|
|
656
|
+
canPasskey,
|
|
657
|
+
code,
|
|
658
|
+
setCode,
|
|
659
|
+
recovery,
|
|
660
|
+
setRecovery,
|
|
661
|
+
wait,
|
|
662
|
+
continueWithEmail,
|
|
663
|
+
social,
|
|
664
|
+
sendCode,
|
|
665
|
+
verifyCode,
|
|
666
|
+
passkey,
|
|
667
|
+
submitPassword,
|
|
668
|
+
submitMfa
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
// src/sign-in.tsx
|
|
672
|
+
var _tmpl$ = [
|
|
673
|
+
"<p",
|
|
674
|
+
">",
|
|
675
|
+
"</p>"
|
|
676
|
+
];
|
|
677
|
+
var _tmpl$2 = [
|
|
678
|
+
"<p",
|
|
679
|
+
" role=\"alert\"",
|
|
680
|
+
">",
|
|
681
|
+
"</p>"
|
|
682
|
+
];
|
|
683
|
+
var _tmpl$3 = [
|
|
684
|
+
"<label",
|
|
685
|
+
">",
|
|
686
|
+
"</label>"
|
|
687
|
+
];
|
|
688
|
+
var _tmpl$4 = [
|
|
689
|
+
"<input",
|
|
690
|
+
" type=\"email\" name=\"username\" autocomplete=\"username\" required maxlength=\"254\"",
|
|
691
|
+
">"
|
|
692
|
+
];
|
|
693
|
+
var _tmpl$5 = [
|
|
694
|
+
"<form",
|
|
695
|
+
" method=\"post\" action=\"/auth/email\"",
|
|
696
|
+
"><!--$-->",
|
|
697
|
+
"<!--/--><label",
|
|
698
|
+
">",
|
|
699
|
+
"</label><div",
|
|
700
|
+
"><input",
|
|
701
|
+
" name=\"password\" required",
|
|
702
|
+
" maxlength=\"1024\"",
|
|
703
|
+
"><button type=\"button\"",
|
|
704
|
+
">",
|
|
705
|
+
"</button></div><!--$-->",
|
|
706
|
+
"<!--/--><button type=\"submit\"",
|
|
707
|
+
"",
|
|
708
|
+
">",
|
|
709
|
+
"</button></form>"
|
|
710
|
+
];
|
|
711
|
+
var _tmpl$6 = [
|
|
712
|
+
"<button",
|
|
713
|
+
" type=\"button\"",
|
|
714
|
+
"",
|
|
715
|
+
">",
|
|
716
|
+
"</button>"
|
|
717
|
+
];
|
|
718
|
+
var _tmpl$7 = [
|
|
719
|
+
"<button",
|
|
720
|
+
" type=\"button\"",
|
|
721
|
+
">",
|
|
722
|
+
"</button>"
|
|
723
|
+
];
|
|
724
|
+
var _tmpl$8 = [
|
|
725
|
+
"<form",
|
|
726
|
+
" method=\"post\" action=\"/auth/email\"",
|
|
727
|
+
"><label",
|
|
728
|
+
">",
|
|
729
|
+
"</label><div",
|
|
730
|
+
"><input",
|
|
731
|
+
" type=\"text\" inputmode=\"numeric\" autocomplete=\"one-time-code\"",
|
|
732
|
+
"",
|
|
733
|
+
"><div aria-hidden=\"true\"",
|
|
734
|
+
">",
|
|
735
|
+
"</div></div><button type=\"submit\"",
|
|
736
|
+
"",
|
|
737
|
+
">",
|
|
738
|
+
"</button></form>"
|
|
739
|
+
];
|
|
740
|
+
var _tmpl$9 = [
|
|
741
|
+
"<div",
|
|
742
|
+
"><button type=\"button\"",
|
|
743
|
+
"",
|
|
744
|
+
">",
|
|
745
|
+
"</button><button type=\"button\"",
|
|
746
|
+
"",
|
|
747
|
+
">",
|
|
748
|
+
"</button><!--$-->",
|
|
749
|
+
"<!--/--></div>"
|
|
750
|
+
];
|
|
751
|
+
var _tmpl$0 = [
|
|
752
|
+
"<form",
|
|
753
|
+
" method=\"post\" action=\"/auth/email\"",
|
|
754
|
+
"><label",
|
|
755
|
+
">",
|
|
756
|
+
"</label><input",
|
|
757
|
+
" name=\"code\"",
|
|
758
|
+
" autocomplete=\"one-time-code\" required",
|
|
759
|
+
"><button type=\"submit\"",
|
|
760
|
+
"",
|
|
761
|
+
">",
|
|
762
|
+
"</button></form>"
|
|
763
|
+
];
|
|
764
|
+
var _tmpl$1 = [
|
|
765
|
+
"<div",
|
|
766
|
+
"><button type=\"button\"",
|
|
767
|
+
">",
|
|
768
|
+
"</button><button type=\"button\"",
|
|
769
|
+
">",
|
|
770
|
+
"</button></div>"
|
|
771
|
+
];
|
|
772
|
+
var _tmpl$10 = [
|
|
773
|
+
"<div",
|
|
774
|
+
"><label",
|
|
775
|
+
">",
|
|
776
|
+
"</label><select",
|
|
777
|
+
">",
|
|
778
|
+
"</select></div>"
|
|
779
|
+
];
|
|
780
|
+
var _tmpl$11 = [
|
|
781
|
+
"<section",
|
|
782
|
+
" style=\"",
|
|
783
|
+
"\"",
|
|
784
|
+
"><div",
|
|
785
|
+
"><!--$-->",
|
|
786
|
+
"<!--/--><h1",
|
|
787
|
+
">",
|
|
788
|
+
"</h1><p",
|
|
789
|
+
">",
|
|
790
|
+
"</p><!--$-->",
|
|
791
|
+
"<!--/--><!--$-->",
|
|
792
|
+
"<!--/--><!--$-->",
|
|
793
|
+
"<!--/--><!--$-->",
|
|
794
|
+
"<!--/--></div></section>"
|
|
795
|
+
];
|
|
796
|
+
var _tmpl$12 = [
|
|
797
|
+
"<output",
|
|
798
|
+
">",
|
|
799
|
+
"</output>"
|
|
800
|
+
];
|
|
801
|
+
var _tmpl$13 = [
|
|
802
|
+
"<div",
|
|
803
|
+
">",
|
|
804
|
+
"</div>"
|
|
805
|
+
];
|
|
806
|
+
var _tmpl$14 = [
|
|
807
|
+
"<form",
|
|
808
|
+
" method=\"post\" action=\"/auth/email\"",
|
|
809
|
+
"><label",
|
|
810
|
+
">",
|
|
811
|
+
"</label><input",
|
|
812
|
+
" type=\"email\" name=\"email\" autocomplete=\"username\" required maxlength=\"254\"",
|
|
813
|
+
"><button type=\"submit\"",
|
|
814
|
+
"",
|
|
815
|
+
">",
|
|
816
|
+
"</button></form>"
|
|
817
|
+
];
|
|
818
|
+
var _tmpl$15 = [
|
|
819
|
+
"<p",
|
|
820
|
+
"><!--$-->",
|
|
821
|
+
"<!--/--> <button type=\"button\"",
|
|
822
|
+
"",
|
|
823
|
+
">",
|
|
824
|
+
"</button></p>"
|
|
825
|
+
];
|
|
826
|
+
var _tmpl$16 = [
|
|
827
|
+
"<button",
|
|
828
|
+
" type=\"button\"",
|
|
829
|
+
"",
|
|
830
|
+
"><!--$-->",
|
|
831
|
+
"<!--/--><!--$-->",
|
|
832
|
+
"<!--/--></button>"
|
|
833
|
+
];
|
|
834
|
+
var _tmpl$17 = [
|
|
835
|
+
"<input",
|
|
836
|
+
" tabindex=\"-1\" hidden name=\"username\"",
|
|
837
|
+
" autocomplete=\"username\" readonly>"
|
|
838
|
+
];
|
|
839
|
+
var _tmpl$18 = [
|
|
840
|
+
"<span",
|
|
841
|
+
">",
|
|
842
|
+
"</span>"
|
|
843
|
+
];
|
|
844
|
+
var _tmpl$19 = [
|
|
845
|
+
"<option",
|
|
846
|
+
"",
|
|
847
|
+
">",
|
|
848
|
+
"</option>"
|
|
849
|
+
];
|
|
850
|
+
var locales = Object.keys(localeNames);
|
|
851
|
+
var icons = {
|
|
852
|
+
google: GoogleIcon,
|
|
853
|
+
github: GitHubIcon,
|
|
854
|
+
apple: AppleIcon,
|
|
855
|
+
facebook: FacebookIcon,
|
|
856
|
+
microsoft: MicrosoftIcon
|
|
857
|
+
};
|
|
858
|
+
function SylphxSignIn(props) {
|
|
859
|
+
const { config, configFailed, loadConfig, step, email, setEmail, errorCode, busy, showPassword, setShowPassword, canPasskey, code, setCode, recovery, setRecovery, wait, continueWithEmail, social, sendCode, verifyCode, passkey, submitPassword, submitMfa } = createSignInController(props);
|
|
860
|
+
const [detected, setDetected] = createSignal();
|
|
861
|
+
const [selected, setSelected] = createSignal();
|
|
862
|
+
const locale = createMemo(() => props.locale === void 0 ? selected() ?? detected() ?? resolveAuthLocale(props.localePreferences ?? []) : resolveAuthLocale([props.locale, ...props.localePreferences ?? []]));
|
|
863
|
+
const text = () => catalogs[locale()];
|
|
864
|
+
const seconds = createMemo(() => authSecondsFormat(locale()));
|
|
865
|
+
const error = () => {
|
|
866
|
+
const code = errorCode();
|
|
867
|
+
return code ? text().errors[code] : "";
|
|
868
|
+
};
|
|
869
|
+
onMount(() => {
|
|
870
|
+
if (props.locale === void 0 && !props.localePreferences?.length) setDetected(resolveAuthLocale(navigator.languages));
|
|
871
|
+
});
|
|
872
|
+
const prefix = createUniqueId();
|
|
873
|
+
const id = (name) => `${prefix}-${name}`;
|
|
874
|
+
function className(part) {
|
|
875
|
+
const custom = props.appearance?.classes?.[part];
|
|
876
|
+
if (props.appearance?.unstyled) return custom;
|
|
877
|
+
return custom ? `auth-sign-in-${part} ${custom}` : `auth-sign-in-${part}`;
|
|
878
|
+
}
|
|
879
|
+
return ssr(_tmpl$11, ssrHydrationKey() + ssrAttribute("class", escape(className("panel"), true), false), ssrStyle(props.appearance?.tokens), ssrAttribute("aria-labelledby", escape(id("title"), true), false) + ssrAttribute("lang", escape(locale(), true), false), ssrAttribute("class", escape(className("content"), true), false), escape(createComponent(Show, {
|
|
880
|
+
get when() {
|
|
881
|
+
return props.kicker;
|
|
882
|
+
},
|
|
883
|
+
get children() {
|
|
884
|
+
return ssr(_tmpl$, ssrHydrationKey() + ssrAttribute("class", escape(className("kicker"), true), false), escape(props.kicker));
|
|
885
|
+
}
|
|
886
|
+
})), ssrAttribute("id", escape(id("title"), true), false) + ssrAttribute("class", escape(className("title"), true), false), escape({
|
|
887
|
+
choose: props.title ?? text().signIn,
|
|
888
|
+
password: text().enterPassword,
|
|
889
|
+
signup: text().createYourAccount,
|
|
890
|
+
check_email: text().checkInbox,
|
|
891
|
+
confirm: text().confirmEmail,
|
|
892
|
+
otp: text().checkInbox,
|
|
893
|
+
mfa: text().verifyIdentity
|
|
894
|
+
}[step()]), ssrAttribute("class", escape(className("sub"), true), false), escape({
|
|
895
|
+
choose: props.description ?? text().chooseMethod,
|
|
896
|
+
password: email(),
|
|
897
|
+
signup: text().startWithEmail,
|
|
898
|
+
check_email: text().checkEmailDescription,
|
|
899
|
+
confirm: text().confirmEmailDescription,
|
|
900
|
+
otp: text().enterEmailCode(email()),
|
|
901
|
+
mfa: recovery() ? text().enterRecovery : text().enterAuthenticator
|
|
902
|
+
}[step()]), escape(createComponent(Show, {
|
|
903
|
+
get when() {
|
|
904
|
+
return error();
|
|
905
|
+
},
|
|
906
|
+
get children() {
|
|
907
|
+
return ssr(_tmpl$2, ssrHydrationKey(), ssrAttribute("class", escape(className("error"), true), false), escape(error()));
|
|
908
|
+
}
|
|
909
|
+
})), escape(createComponent(Switch, { get children() {
|
|
910
|
+
return [
|
|
911
|
+
createComponent(Match, {
|
|
912
|
+
get when() {
|
|
913
|
+
return step() === "choose";
|
|
914
|
+
},
|
|
915
|
+
get children() {
|
|
916
|
+
return createComponent(Show, {
|
|
917
|
+
get when() {
|
|
918
|
+
return config();
|
|
919
|
+
},
|
|
920
|
+
get fallback() {
|
|
921
|
+
return createComponent(Show, {
|
|
922
|
+
get when() {
|
|
923
|
+
return configFailed();
|
|
924
|
+
},
|
|
925
|
+
get fallback() {
|
|
926
|
+
return ssr(_tmpl$12, ssrHydrationKey() + ssrAttribute("class", escape(className("loading"), true), false), escape(text().loading));
|
|
927
|
+
},
|
|
928
|
+
get children() {
|
|
929
|
+
return [ssr(_tmpl$2, ssrHydrationKey(), ssrAttribute("class", escape(className("error"), true), false), escape(text().errors.unavailable)), ssr(_tmpl$7, ssrHydrationKey(), ssrAttribute("class", escape(className("secondary"), true), false), escape(text().retry))];
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
},
|
|
933
|
+
children: (methods) => [
|
|
934
|
+
ssr(_tmpl$13, ssrHydrationKey() + ssrAttribute("class", escape(className("providers"), true), false), escape(createComponent(For, {
|
|
935
|
+
get each() {
|
|
936
|
+
return methods().providers;
|
|
937
|
+
},
|
|
938
|
+
children: (provider) => {
|
|
939
|
+
const Icon = icons[provider];
|
|
940
|
+
return ssr(_tmpl$16, ssrHydrationKey(), ssrAttribute("class", escape(className("secondary"), true), false), ssrAttribute("disabled", !!busy(), true), Icon && escape(createComponent(Icon, {})), busy() === providers[provider][0] ? escape(text().openingProvider(providers[provider][0])) : escape(text().continueProvider(providers[provider][0])));
|
|
941
|
+
}
|
|
942
|
+
}))),
|
|
943
|
+
createComponent(Show, {
|
|
944
|
+
get when() {
|
|
945
|
+
return methods().password || methods().otp;
|
|
946
|
+
},
|
|
947
|
+
get children() {
|
|
948
|
+
return [createComponent(Show, {
|
|
949
|
+
get when() {
|
|
950
|
+
return methods().providers.length;
|
|
951
|
+
},
|
|
952
|
+
get children() {
|
|
953
|
+
return ssr(_tmpl$13, ssrHydrationKey() + ssrAttribute("class", escape(className("divider"), true), false), escape(text().orEmail));
|
|
954
|
+
}
|
|
955
|
+
}), ssr(_tmpl$14, ssrHydrationKey(), ssrAttribute("class", escape(className("form"), true), false), ssrAttribute("for", escape(id("email"), true), false), escape(text().email), ssrAttribute("id", escape(id("email"), true), false), ssrAttribute("value", escape(email(), true), false), ssrAttribute("class", escape(className("primary"), true), false), ssrAttribute("disabled", !!busy(), true), busy() === "email" ? escape(text().sendingCode) : methods().otp ? escape(text().emailCodeAction) : escape(text().continueEmail))];
|
|
956
|
+
}
|
|
957
|
+
}),
|
|
958
|
+
createComponent(Show, {
|
|
959
|
+
get when() {
|
|
960
|
+
return memo(() => !!methods().passkey)() && canPasskey();
|
|
961
|
+
},
|
|
962
|
+
get children() {
|
|
963
|
+
return ssr(_tmpl$6, ssrHydrationKey(), ssrAttribute("class", escape(className("link"), true), false), ssrAttribute("disabled", !!busy(), true), busy() === "passkey" ? escape(text().waitingPasskey) : escape(text().usePasskey));
|
|
964
|
+
}
|
|
965
|
+
}),
|
|
966
|
+
createComponent(Show, {
|
|
967
|
+
get when() {
|
|
968
|
+
return methods().signup;
|
|
969
|
+
},
|
|
970
|
+
get children() {
|
|
971
|
+
return ssr(_tmpl$15, ssrHydrationKey() + ssrAttribute("class", escape(className("switch"), true), false), escape(text().newHere), ssrAttribute("class", escape(className("link"), true), false), ssrAttribute("disabled", !!busy(), true), escape(text().createAnAccount));
|
|
972
|
+
}
|
|
973
|
+
}),
|
|
974
|
+
createComponent(Show, {
|
|
975
|
+
get when() {
|
|
976
|
+
return memo(() => !!(!methods().password && !methods().signup && !methods().otp && !methods().providers.length))() && !(methods().passkey && canPasskey());
|
|
977
|
+
},
|
|
978
|
+
get children() {
|
|
979
|
+
return ssr(_tmpl$12, ssrHydrationKey(), escape(text().noMethods));
|
|
980
|
+
}
|
|
981
|
+
})
|
|
982
|
+
]
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
}),
|
|
986
|
+
createComponent(Match, {
|
|
987
|
+
get when() {
|
|
988
|
+
return step() === "password" || step() === "signup" || step() === "confirm";
|
|
989
|
+
},
|
|
990
|
+
get children() {
|
|
991
|
+
return [ssr(_tmpl$5, ssrHydrationKey(), ssrAttribute("class", escape(className("form"), true), false), escape(createComponent(Show, {
|
|
992
|
+
get when() {
|
|
993
|
+
return step() !== "password";
|
|
994
|
+
},
|
|
995
|
+
get fallback() {
|
|
996
|
+
return ssr(_tmpl$17, ssrHydrationKey(), ssrAttribute("value", escape(email(), true), false));
|
|
997
|
+
},
|
|
998
|
+
get children() {
|
|
999
|
+
return [ssr(_tmpl$3, ssrHydrationKey() + ssrAttribute("for", escape(id("account-email"), true), false), escape(text().email)), ssr(_tmpl$4, ssrHydrationKey() + ssrAttribute("id", escape(id("account-email"), true), false), ssrAttribute("value", escape(email(), true), false))];
|
|
1000
|
+
}
|
|
1001
|
+
})), ssrAttribute("for", escape(id("password"), true), false), escape(text().password), ssrAttribute("class", escape(className("password"), true), false), ssrAttribute("id", escape(id("password"), true), false) + ssrAttribute("type", showPassword() ? "text" : "password", false) + ssrAttribute("autocomplete", step() === "signup" ? "new-password" : "current-password", false), ssrAttribute("minlength", step() === "signup" ? 12 : escape(void 0, true), false), ssrAttribute("aria-describedby", step() === "signup" ? escape(id("password-hint"), true) : escape(void 0, true), false), ssrAttribute("class", escape(className("link"), true), false) + ssrAttribute("aria-label", showPassword() ? escape(text().hidePassword, true) : escape(text().showPassword, true), false), showPassword() ? escape(text().hide) : escape(text().show), escape(createComponent(Show, {
|
|
1002
|
+
get when() {
|
|
1003
|
+
return step() === "signup";
|
|
1004
|
+
},
|
|
1005
|
+
get children() {
|
|
1006
|
+
return ssr(_tmpl$, ssrHydrationKey() + ssrAttribute("class", escape(className("hint"), true), false) + ssrAttribute("id", escape(id("password-hint"), true), false), escape(text().minimumPassword));
|
|
1007
|
+
}
|
|
1008
|
+
})), ssrAttribute("class", escape(className("primary"), true), false), ssrAttribute("disabled", !!busy(), true), busy() ? escape(text().working) : step() === "signup" ? escape(text().createAccount) : step() === "confirm" ? escape(text().confirmAndSignIn) : escape(text().signIn)), ssr(_tmpl$6, ssrHydrationKey(), ssrAttribute("class", escape(className("link"), true), false), ssrAttribute("disabled", !!busy(), true), step() === "password" ? escape(text().changeEmailOrMethod) : escape(text().backToSignIn))];
|
|
1009
|
+
}
|
|
1010
|
+
}),
|
|
1011
|
+
createComponent(Match, {
|
|
1012
|
+
get when() {
|
|
1013
|
+
return step() === "check_email";
|
|
1014
|
+
},
|
|
1015
|
+
get children() {
|
|
1016
|
+
return ssr(_tmpl$7, ssrHydrationKey(), ssrAttribute("class", escape(className("secondary"), true), false), escape(text().backToSignIn));
|
|
1017
|
+
}
|
|
1018
|
+
}),
|
|
1019
|
+
createComponent(Match, {
|
|
1020
|
+
get when() {
|
|
1021
|
+
return step() === "otp";
|
|
1022
|
+
},
|
|
1023
|
+
get children() {
|
|
1024
|
+
return [ssr(_tmpl$8, ssrHydrationKey(), ssrAttribute("class", escape(className("form"), true), false), ssrAttribute("for", escape(id("code"), true), false), escape(text().emailCode), ssrAttribute("class", escape(className("otp"), true), false), ssrAttribute("id", escape(id("code"), true), false), ssrAttribute("value", escape(code(), true), false), ssrAttribute("readonly", !!busy(), true), ssrAttribute("class", escape(className("cells"), true), false), escape(createComponent(For, {
|
|
1025
|
+
each: [
|
|
1026
|
+
0,
|
|
1027
|
+
1,
|
|
1028
|
+
2,
|
|
1029
|
+
3,
|
|
1030
|
+
4,
|
|
1031
|
+
5
|
|
1032
|
+
],
|
|
1033
|
+
children: (i) => ssr(_tmpl$18, ssrHydrationKey(), escape(code()[i] ?? ""))
|
|
1034
|
+
})), ssrAttribute("class", escape(className("primary"), true), false), ssrAttribute("disabled", !!busy() || code().length !== 6, true), busy() === "verify" ? escape(text().checkingCode) : escape(text().verifyCode)), ssr(_tmpl$9, ssrHydrationKey() + ssrAttribute("class", escape(className("actions"), true), false), ssrAttribute("class", escape(className("link"), true), false), ssrAttribute("disabled", !!busy() || wait() > 0, true), wait() ? escape(text().resendIn(seconds().format(wait()))) : escape(text().resendCode), ssrAttribute("class", escape(className("link"), true), false), ssrAttribute("disabled", !!busy(), true), escape(text().changeEmail), escape(createComponent(Show, {
|
|
1035
|
+
get when() {
|
|
1036
|
+
return config()?.password;
|
|
1037
|
+
},
|
|
1038
|
+
get children() {
|
|
1039
|
+
return ssr(_tmpl$6, ssrHydrationKey(), ssrAttribute("class", escape(className("link"), true), false), ssrAttribute("disabled", !!busy(), true), escape(text().usePassword));
|
|
1040
|
+
}
|
|
1041
|
+
})))];
|
|
1042
|
+
}
|
|
1043
|
+
}),
|
|
1044
|
+
createComponent(Match, {
|
|
1045
|
+
get when() {
|
|
1046
|
+
return step() === "mfa";
|
|
1047
|
+
},
|
|
1048
|
+
get children() {
|
|
1049
|
+
return [ssr(_tmpl$0, ssrHydrationKey(), ssrAttribute("class", escape(className("form"), true), false), ssrAttribute("for", escape(id("mfa"), true), false), recovery() ? escape(text().recoveryCode) : escape(text().authenticatorCode), ssrAttribute("id", escape(id("mfa"), true), false), ssrAttribute("inputmode", recovery() ? "text" : "numeric", false), ssrAttribute("maxlength", recovery() ? 128 : 6, false), ssrAttribute("class", escape(className("primary"), true), false), ssrAttribute("disabled", !!busy(), true), busy() ? escape(text().checkingCode) : escape(text().verifyAndSignIn)), ssr(_tmpl$1, ssrHydrationKey() + ssrAttribute("class", escape(className("actions"), true), false), ssrAttribute("disabled", !!busy(), true) + ssrAttribute("class", escape(className("link"), true), false), recovery() ? escape(text().useAuthenticator) : escape(text().useRecovery), ssrAttribute("disabled", !!busy(), true) + ssrAttribute("class", escape(className("link"), true), false), escape(text().backToSignIn))];
|
|
1050
|
+
}
|
|
1051
|
+
})
|
|
1052
|
+
];
|
|
1053
|
+
} })), escape(createComponent(Show, {
|
|
1054
|
+
get when() {
|
|
1055
|
+
return memo(() => props.showLocaleSelector !== false)() && (props.locale === void 0 || props.onLocaleChange);
|
|
1056
|
+
},
|
|
1057
|
+
get children() {
|
|
1058
|
+
return ssr(_tmpl$10, ssrHydrationKey() + ssrAttribute("class", escape(className("locale"), true), false), ssrAttribute("for", escape(id("locale"), true), false), escape(text().language), ssrAttribute("id", escape(id("locale"), true), false) + ssrAttribute("value", escape(locale(), true), false), escape(createComponent(For, {
|
|
1059
|
+
each: locales,
|
|
1060
|
+
children: (item) => ssr(_tmpl$19, ssrHydrationKey() + ssrAttribute("value", escape(item, true), false) + ssrAttribute("lang", escape(item, true), false), ssrAttribute("selected", locale() === item, true), escape(localeNames[item]))
|
|
1061
|
+
})));
|
|
1062
|
+
}
|
|
1063
|
+
})), escape(createComponent(Show, {
|
|
1064
|
+
get when() {
|
|
1065
|
+
return props.agreement;
|
|
1066
|
+
},
|
|
1067
|
+
get children() {
|
|
1068
|
+
return ssr(_tmpl$, ssrHydrationKey() + ssrAttribute("class", escape(className("agreement"), true), false), escape(props.agreement));
|
|
1069
|
+
}
|
|
1070
|
+
})));
|
|
1071
|
+
}
|
|
1072
|
+
export { SylphxSignIn, createSignInController, localeNames, resolveAuthLocale, catalogs as signInMessages };
|