@atproto/oauth-provider-ui 0.0.2 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authorization-page-Cms-rcBA.js +3 -0
- package/dist/authorization-page-Cms-rcBA.js.map +1 -0
- package/dist/{assets/bundle-manifest.json → bundle-manifest.json} +197 -197
- package/dist/error-page-DC6Vc-cv.js +2 -0
- package/dist/error-page-DC6Vc-cv.js.map +1 -0
- package/dist/error-view-CRGNTAn2.css +1 -0
- package/dist/error-view-MVy7C9l0.js +59 -0
- package/dist/error-view-MVy7C9l0.js.map +1 -0
- package/dist/index-CHPoD7Rp.js +20 -0
- package/dist/index-CHPoD7Rp.js.map +1 -0
- package/dist/messages-B0mgsxS-.js +2 -0
- package/dist/messages-B0mgsxS-.js.map +1 -0
- package/dist/messages-B5g8Fkio.js +2 -0
- package/dist/messages-B5g8Fkio.js.map +1 -0
- package/dist/messages-BCMss-Kt.js +2 -0
- package/dist/messages-BCMss-Kt.js.map +1 -0
- package/dist/messages-BGUrKgyK.js +2 -0
- package/dist/messages-BGUrKgyK.js.map +1 -0
- package/dist/messages-BjxAnLDp.js +2 -0
- package/dist/messages-BjxAnLDp.js.map +1 -0
- package/dist/messages-Bjysz3rI.js +2 -0
- package/dist/messages-Bjysz3rI.js.map +1 -0
- package/dist/messages-BvvEr3UX.js +2 -0
- package/dist/messages-BvvEr3UX.js.map +1 -0
- package/dist/messages-Bz6JOhJf.js +2 -0
- package/dist/messages-Bz6JOhJf.js.map +1 -0
- package/dist/messages-BzL3D1EU.js +2 -0
- package/dist/messages-BzL3D1EU.js.map +1 -0
- package/dist/messages-CAvN5UoW.js +2 -0
- package/dist/messages-CAvN5UoW.js.map +1 -0
- package/dist/messages-CEmswT1Q.js +2 -0
- package/dist/messages-CEmswT1Q.js.map +1 -0
- package/dist/messages-CHYqz0q6.js +2 -0
- package/dist/messages-CHYqz0q6.js.map +1 -0
- package/dist/messages-CRmpdijj.js +2 -0
- package/dist/messages-CRmpdijj.js.map +1 -0
- package/dist/messages-Cdb79R6S.js +2 -0
- package/dist/messages-Cdb79R6S.js.map +1 -0
- package/dist/messages-ChkJ_0WT.js +2 -0
- package/dist/messages-ChkJ_0WT.js.map +1 -0
- package/dist/messages-CqiEX6JJ.js +2 -0
- package/dist/messages-CqiEX6JJ.js.map +1 -0
- package/dist/messages-CxkHjJSR.js +2 -0
- package/dist/messages-CxkHjJSR.js.map +1 -0
- package/dist/messages-D0-cWoJ9.js +2 -0
- package/dist/messages-D0-cWoJ9.js.map +1 -0
- package/dist/messages-D2MnAxYY.js +2 -0
- package/dist/messages-D2MnAxYY.js.map +1 -0
- package/dist/messages-D5TZVsui.js +2 -0
- package/dist/messages-D5TZVsui.js.map +1 -0
- package/dist/messages-DBdV4-iw.js +2 -0
- package/dist/messages-DBdV4-iw.js.map +1 -0
- package/dist/messages-DEK3zybC.js +2 -0
- package/dist/messages-DEK3zybC.js.map +1 -0
- package/dist/messages-DGSM5jkd.js +2 -0
- package/dist/messages-DGSM5jkd.js.map +1 -0
- package/dist/messages-DJgAnSTQ.js +2 -0
- package/dist/messages-DJgAnSTQ.js.map +1 -0
- package/dist/messages-DK7O7sb_.js +2 -0
- package/dist/messages-DK7O7sb_.js.map +1 -0
- package/dist/messages-DRp7qc3j.js +2 -0
- package/dist/messages-DRp7qc3j.js.map +1 -0
- package/dist/messages-DT6xRw0m.js +2 -0
- package/dist/messages-DT6xRw0m.js.map +1 -0
- package/dist/messages-LnzLtU0L.js +2 -0
- package/dist/messages-LnzLtU0L.js.map +1 -0
- package/dist/messages-_Nk2qNGw.js +2 -0
- package/dist/messages-_Nk2qNGw.js.map +1 -0
- package/dist/messages-eHH6nZyF.js +2 -0
- package/dist/messages-eHH6nZyF.js.map +1 -0
- package/dist/messages-iNw8zY2C.js +2 -0
- package/dist/messages-iNw8zY2C.js.map +1 -0
- package/dist/messages-ipc0L8yF.js +2 -0
- package/dist/messages-ipc0L8yF.js.map +1 -0
- package/dist/messages-j7LsWm2F.js +2 -0
- package/dist/messages-j7LsWm2F.js.map +1 -0
- package/dist/messages-mgE_5UEw.js +2 -0
- package/dist/messages-mgE_5UEw.js.map +1 -0
- package/dist/messages-oRd-J5--.js +2 -0
- package/dist/messages-oRd-J5--.js.map +1 -0
- package/hydration-data.d.ts +42 -0
- package/package.json +30 -37
- package/.linguirc +0 -57
- package/CHANGELOG.md +0 -7
- package/CONTRIBUTING.md +0 -6
- package/dist/assets/COdVzed-.css +0 -3
- package/dist/assets/COdVzed-.js +0 -100
- package/dist/assets/COdVzed-.js.map +0 -1
- package/dist/assets/Cqnfnbvc.js +0 -6
- package/dist/assets/Cqnfnbvc.js.map +0 -1
- package/dist/assets/error-view-Bu4y7Nd8.js +0 -208
- package/dist/assets/error-view-Bu4y7Nd8.js.map +0 -1
- package/dist/assets/index-DXlCRM6V.js +0 -36
- package/dist/assets/index-DXlCRM6V.js.map +0 -1
- package/dist/assets/messages-2GoTm2qL.js +0 -4
- package/dist/assets/messages-2GoTm2qL.js.map +0 -1
- package/dist/assets/messages-6Cn2Jbhw.js +0 -4
- package/dist/assets/messages-6Cn2Jbhw.js.map +0 -1
- package/dist/assets/messages-75hFgOK2.js +0 -4
- package/dist/assets/messages-75hFgOK2.js.map +0 -1
- package/dist/assets/messages-B3OK4k0O.js +0 -4
- package/dist/assets/messages-B3OK4k0O.js.map +0 -1
- package/dist/assets/messages-BNXlPzKV.js +0 -4
- package/dist/assets/messages-BNXlPzKV.js.map +0 -1
- package/dist/assets/messages-BUygB8mD.js +0 -4
- package/dist/assets/messages-BUygB8mD.js.map +0 -1
- package/dist/assets/messages-BVPPcwNr.js +0 -4
- package/dist/assets/messages-BVPPcwNr.js.map +0 -1
- package/dist/assets/messages-BbbWUQS8.js +0 -4
- package/dist/assets/messages-BbbWUQS8.js.map +0 -1
- package/dist/assets/messages-BibKCYyW.js +0 -4
- package/dist/assets/messages-BibKCYyW.js.map +0 -1
- package/dist/assets/messages-BlPrr9_7.js +0 -4
- package/dist/assets/messages-BlPrr9_7.js.map +0 -1
- package/dist/assets/messages-ByVCw40U.js +0 -4
- package/dist/assets/messages-ByVCw40U.js.map +0 -1
- package/dist/assets/messages-C5DU1neP.js +0 -4
- package/dist/assets/messages-C5DU1neP.js.map +0 -1
- package/dist/assets/messages-C6IgUtbX.js +0 -4
- package/dist/assets/messages-C6IgUtbX.js.map +0 -1
- package/dist/assets/messages-C92Zzt2o.js +0 -4
- package/dist/assets/messages-C92Zzt2o.js.map +0 -1
- package/dist/assets/messages-CGZqYT14.js +0 -4
- package/dist/assets/messages-CGZqYT14.js.map +0 -1
- package/dist/assets/messages-CGlsy4wt.js +0 -4
- package/dist/assets/messages-CGlsy4wt.js.map +0 -1
- package/dist/assets/messages-CPT1nd0u.js +0 -4
- package/dist/assets/messages-CPT1nd0u.js.map +0 -1
- package/dist/assets/messages-CTTdXyw_.js +0 -4
- package/dist/assets/messages-CTTdXyw_.js.map +0 -1
- package/dist/assets/messages-ChK_C_Pj.js +0 -4
- package/dist/assets/messages-ChK_C_Pj.js.map +0 -1
- package/dist/assets/messages-CjJbk7Uf.js +0 -4
- package/dist/assets/messages-CjJbk7Uf.js.map +0 -1
- package/dist/assets/messages-CoiLjLYO.js +0 -4
- package/dist/assets/messages-CoiLjLYO.js.map +0 -1
- package/dist/assets/messages-Cwx6B4Ti.js +0 -4
- package/dist/assets/messages-Cwx6B4Ti.js.map +0 -1
- package/dist/assets/messages-D0uXAp_H.js +0 -4
- package/dist/assets/messages-D0uXAp_H.js.map +0 -1
- package/dist/assets/messages-DG0_arU0.js +0 -4
- package/dist/assets/messages-DG0_arU0.js.map +0 -1
- package/dist/assets/messages-DOXFJh9K.js +0 -4
- package/dist/assets/messages-DOXFJh9K.js.map +0 -1
- package/dist/assets/messages-DPK7nOoC.js +0 -4
- package/dist/assets/messages-DPK7nOoC.js.map +0 -1
- package/dist/assets/messages-Duccgtu0.js +0 -4
- package/dist/assets/messages-Duccgtu0.js.map +0 -1
- package/dist/assets/messages-DxTqgsHq.js +0 -4
- package/dist/assets/messages-DxTqgsHq.js.map +0 -1
- package/dist/assets/messages-E5_lTg7A.js +0 -4
- package/dist/assets/messages-E5_lTg7A.js.map +0 -1
- package/dist/assets/messages-UhunAjh1.js +0 -4
- package/dist/assets/messages-UhunAjh1.js.map +0 -1
- package/dist/assets/messages-Xg_3YLGw.js +0 -4
- package/dist/assets/messages-Xg_3YLGw.js.map +0 -1
- package/dist/assets/messages-iliBQHY2.js +0 -4
- package/dist/assets/messages-iliBQHY2.js.map +0 -1
- package/dist/assets/messages-lRprpIl-.js +0 -4
- package/dist/assets/messages-lRprpIl-.js.map +0 -1
- package/dist/assets/messages-pbPHQbz1.js +0 -4
- package/dist/assets/messages-pbPHQbz1.js.map +0 -1
- package/dist/assets/messages-q-O7ZQGs.js +0 -4
- package/dist/assets/messages-q-O7ZQGs.js.map +0 -1
- package/dist/lib/index.d.ts +0 -19
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/index.js +0 -47
- package/dist/lib/index.js.map +0 -1
- package/dist/tsconfig.backend.tsbuildinfo +0 -1
- package/lib/index.ts +0 -72
- package/rollup.config.js +0 -102
- package/src/authorization-page.html +0 -183
- package/src/authorization-page.tsx +0 -55
- package/src/backend-data.ts +0 -35
- package/src/components/forms/button-toggle-visibility.tsx +0 -43
- package/src/components/forms/button.tsx +0 -60
- package/src/components/forms/fieldset.tsx +0 -55
- package/src/components/forms/form-card-async.tsx +0 -103
- package/src/components/forms/form-card.tsx +0 -49
- package/src/components/forms/input-checkbox.tsx +0 -78
- package/src/components/forms/input-container.tsx +0 -107
- package/src/components/forms/input-email-address.tsx +0 -65
- package/src/components/forms/input-new-password.tsx +0 -62
- package/src/components/forms/input-password.tsx +0 -87
- package/src/components/forms/input-text.tsx +0 -82
- package/src/components/forms/input-token.tsx +0 -94
- package/src/components/forms/wizard-card.tsx +0 -116
- package/src/components/layouts/layout-title-page.tsx +0 -77
- package/src/components/layouts/layout-welcome.tsx +0 -73
- package/src/components/utils/account-identifier.tsx +0 -23
- package/src/components/utils/account-image.tsx +0 -33
- package/src/components/utils/admonition.tsx +0 -52
- package/src/components/utils/client-name.tsx +0 -45
- package/src/components/utils/error-card.tsx +0 -93
- package/src/components/utils/error-message.tsx +0 -88
- package/src/components/utils/help-card.tsx +0 -46
- package/src/components/utils/icons.tsx +0 -88
- package/src/components/utils/link-anchor.tsx +0 -28
- package/src/components/utils/link-title.tsx +0 -26
- package/src/components/utils/multi-lang-string.tsx +0 -56
- package/src/components/utils/password-strength-label.tsx +0 -37
- package/src/components/utils/password-strength-meter.tsx +0 -58
- package/src/components/utils/url-viewer.tsx +0 -73
- package/src/cookies.ts +0 -11
- package/src/error-page.html +0 -125
- package/src/error-page.tsx +0 -29
- package/src/hooks/use-api.ts +0 -182
- package/src/hooks/use-async-action.ts +0 -120
- package/src/hooks/use-bound-dispatch.ts +0 -5
- package/src/hooks/use-browser-color-scheme.ts +0 -31
- package/src/hooks/use-csrf-token.ts +0 -5
- package/src/hooks/use-random-string.ts +0 -37
- package/src/hooks/use-stepper.ts +0 -87
- package/src/index.html +0 -13
- package/src/lib/api.ts +0 -234
- package/src/lib/backend-data.ts +0 -6
- package/src/lib/clsx.ts +0 -6
- package/src/lib/json-client.ts +0 -97
- package/src/lib/password.ts +0 -98
- package/src/lib/ref.ts +0 -17
- package/src/lib/util.ts +0 -13
- package/src/locales/an/messages.po +0 -487
- package/src/locales/ast/messages.po +0 -487
- package/src/locales/ca/messages.po +0 -487
- package/src/locales/da/messages.po +0 -487
- package/src/locales/de/messages.po +0 -487
- package/src/locales/el/messages.po +0 -487
- package/src/locales/en/messages.po +0 -487
- package/src/locales/en-GB/messages.po +0 -487
- package/src/locales/es/messages.po +0 -487
- package/src/locales/eu/messages.po +0 -487
- package/src/locales/fi/messages.po +0 -487
- package/src/locales/fr/messages.po +0 -487
- package/src/locales/ga/messages.po +0 -487
- package/src/locales/gl/messages.po +0 -487
- package/src/locales/hi/messages.po +0 -487
- package/src/locales/hu/messages.po +0 -487
- package/src/locales/ia/messages.po +0 -487
- package/src/locales/id/messages.po +0 -487
- package/src/locales/it/messages.po +0 -487
- package/src/locales/ja/messages.po +0 -487
- package/src/locales/km/messages.po +0 -487
- package/src/locales/ko/messages.po +0 -487
- package/src/locales/load.ts +0 -8
- package/src/locales/locale-context.ts +0 -19
- package/src/locales/locale-provider.tsx +0 -112
- package/src/locales/locale-selector.tsx +0 -58
- package/src/locales/locales.ts +0 -168
- package/src/locales/ne/messages.po +0 -487
- package/src/locales/nl/messages.po +0 -487
- package/src/locales/pl/messages.po +0 -487
- package/src/locales/pt-BR/messages.po +0 -487
- package/src/locales/ro/messages.po +0 -487
- package/src/locales/ru/messages.po +0 -487
- package/src/locales/sv/messages.po +0 -487
- package/src/locales/th/messages.po +0 -487
- package/src/locales/tr/messages.po +0 -487
- package/src/locales/uk/messages.po +0 -487
- package/src/locales/vi/messages.po +0 -487
- package/src/locales/zh-CN/messages.po +0 -487
- package/src/locales/zh-HK/messages.po +0 -487
- package/src/locales/zh-TW/messages.po +0 -487
- package/src/styles.css +0 -33
- package/src/views/authorize/accept/accept-form.tsx +0 -150
- package/src/views/authorize/accept/accept-view.tsx +0 -70
- package/src/views/authorize/authorize-view.tsx +0 -183
- package/src/views/authorize/reset-password/reset-password-confirm-form.tsx +0 -88
- package/src/views/authorize/reset-password/reset-password-request-form.tsx +0 -80
- package/src/views/authorize/reset-password/reset-password-view.tsx +0 -127
- package/src/views/authorize/sign-in/sign-in-form.tsx +0 -242
- package/src/views/authorize/sign-in/sign-in-picker.tsx +0 -116
- package/src/views/authorize/sign-in/sign-in-view.tsx +0 -145
- package/src/views/authorize/sign-up/sign-up-account-form.tsx +0 -142
- package/src/views/authorize/sign-up/sign-up-disclaimer.tsx +0 -51
- package/src/views/authorize/sign-up/sign-up-handle-form.tsx +0 -287
- package/src/views/authorize/sign-up/sign-up-hcaptcha-form.tsx +0 -108
- package/src/views/authorize/sign-up/sign-up-view.tsx +0 -158
- package/src/views/authorize/welcome/welcome-view.tsx +0 -56
- package/src/views/error/error-view.tsx +0 -31
- package/tailwind.config.js +0 -31
- package/tsconfig.backend.json +0 -8
- package/tsconfig.frontend.json +0 -10
- package/tsconfig.frontend.tsbuildinfo +0 -1
- package/tsconfig.json +0 -8
- package/tsconfig.tools.json +0 -8
- package/tsconfig.tools.tsbuildinfo +0 -1
- package/vite.config.mjs +0 -16
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import { Trans, useLingui } from '@lingui/react/macro'
|
|
2
|
-
import { useCallback, useRef, useState } from 'react'
|
|
3
|
-
import { Button } from '../../../components/forms/button.tsx'
|
|
4
|
-
import { Fieldset } from '../../../components/forms/fieldset.tsx'
|
|
5
|
-
import {
|
|
6
|
-
FormCardAsync,
|
|
7
|
-
FormCardAsyncProps,
|
|
8
|
-
} from '../../../components/forms/form-card-async.tsx'
|
|
9
|
-
import { InputCheckbox } from '../../../components/forms/input-checkbox.tsx'
|
|
10
|
-
import { InputPassword } from '../../../components/forms/input-password.tsx'
|
|
11
|
-
import { InputText } from '../../../components/forms/input-text.tsx'
|
|
12
|
-
import { InputToken } from '../../../components/forms/input-token.tsx'
|
|
13
|
-
import { Admonition } from '../../../components/utils/admonition.tsx'
|
|
14
|
-
import { AtSymbolIcon } from '../../../components/utils/icons.tsx'
|
|
15
|
-
import { AsyncActionController } from '../../../hooks/use-async-action.ts'
|
|
16
|
-
import {
|
|
17
|
-
InvalidCredentialsError,
|
|
18
|
-
SecondAuthenticationFactorRequiredError,
|
|
19
|
-
} from '../../../lib/api.ts'
|
|
20
|
-
import { mergeRefs } from '../../../lib/ref.ts'
|
|
21
|
-
import { Override } from '../../../lib/util.ts'
|
|
22
|
-
|
|
23
|
-
export type SignInFormOutput = {
|
|
24
|
-
username: string
|
|
25
|
-
password: string
|
|
26
|
-
remember?: boolean
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type SignInFormProps = Override<
|
|
30
|
-
Omit<FormCardAsyncProps, 'append' | 'onCancel'>,
|
|
31
|
-
{
|
|
32
|
-
usernameDefault?: string
|
|
33
|
-
usernameReadonly?: boolean
|
|
34
|
-
rememberDefault?: boolean
|
|
35
|
-
|
|
36
|
-
onBack?: () => void
|
|
37
|
-
onForgotPassword?: (emailHint?: string) => void
|
|
38
|
-
onSubmit: (
|
|
39
|
-
credentials: SignInFormOutput,
|
|
40
|
-
signal: AbortSignal,
|
|
41
|
-
) => void | PromiseLike<void>
|
|
42
|
-
}
|
|
43
|
-
>
|
|
44
|
-
|
|
45
|
-
export function SignInForm({
|
|
46
|
-
usernameDefault = '',
|
|
47
|
-
usernameReadonly = false,
|
|
48
|
-
rememberDefault = false,
|
|
49
|
-
|
|
50
|
-
onSubmit,
|
|
51
|
-
onBack,
|
|
52
|
-
onForgotPassword,
|
|
53
|
-
|
|
54
|
-
// FormCardAsync
|
|
55
|
-
ref,
|
|
56
|
-
invalid,
|
|
57
|
-
children,
|
|
58
|
-
...props
|
|
59
|
-
}: SignInFormProps) {
|
|
60
|
-
const { t } = useLingui()
|
|
61
|
-
|
|
62
|
-
const [username, setUsername] = useState<string>(usernameDefault)
|
|
63
|
-
const [password, setPassword] = useState<string>('')
|
|
64
|
-
const [remember, setRemember] = useState<boolean>(rememberDefault)
|
|
65
|
-
const [otp, setOtp] = useState<string | null>(null)
|
|
66
|
-
|
|
67
|
-
const [secondFactor, setSecondFactor] =
|
|
68
|
-
useState<null | SecondAuthenticationFactorRequiredError>(null)
|
|
69
|
-
|
|
70
|
-
const [loading, setLoading] = useState(false)
|
|
71
|
-
|
|
72
|
-
const formRef = useRef<AsyncActionController>(null)
|
|
73
|
-
|
|
74
|
-
const clearSecondFactor = useCallback(() => {
|
|
75
|
-
setOtp(null)
|
|
76
|
-
setSecondFactor(null)
|
|
77
|
-
}, [setOtp, setSecondFactor])
|
|
78
|
-
|
|
79
|
-
const resetState = useCallback(() => {
|
|
80
|
-
clearSecondFactor()
|
|
81
|
-
formRef.current?.reset()
|
|
82
|
-
}, [clearSecondFactor, formRef])
|
|
83
|
-
|
|
84
|
-
const doSubmit = useCallback(
|
|
85
|
-
async (signal: AbortSignal) => {
|
|
86
|
-
try {
|
|
87
|
-
await onSubmit(
|
|
88
|
-
{
|
|
89
|
-
username,
|
|
90
|
-
password,
|
|
91
|
-
remember,
|
|
92
|
-
...(secondFactor ? { [secondFactor.type]: otp } : {}),
|
|
93
|
-
},
|
|
94
|
-
signal,
|
|
95
|
-
)
|
|
96
|
-
} catch (err) {
|
|
97
|
-
if (signal.aborted) {
|
|
98
|
-
// If the action was aborted, ignore the error
|
|
99
|
-
return
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (err instanceof SecondAuthenticationFactorRequiredError) {
|
|
103
|
-
setSecondFactor(err)
|
|
104
|
-
|
|
105
|
-
// Do not re-throw 2FA required error to prevent the form from from
|
|
106
|
-
// displaying it. Instead, we handle the error by showing the second
|
|
107
|
-
// factor form.
|
|
108
|
-
return
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (err instanceof InvalidCredentialsError) {
|
|
112
|
-
// If the username/password are not valid, clear the second factor
|
|
113
|
-
// as valid credentials are a pre-requisite for 2FA.
|
|
114
|
-
clearSecondFactor()
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Any thrown err will be displayed through the form's errorRender
|
|
118
|
-
throw err
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
[username, password, remember, secondFactor, otp, onSubmit],
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
return (
|
|
125
|
-
<FormCardAsync
|
|
126
|
-
{...props}
|
|
127
|
-
ref={mergeRefs([ref, formRef])}
|
|
128
|
-
onLoading={setLoading}
|
|
129
|
-
onCancel={onBack}
|
|
130
|
-
cancelLabel={t`Back`}
|
|
131
|
-
append={children}
|
|
132
|
-
invalid={
|
|
133
|
-
invalid || !username || !password || (secondFactor != null && !otp)
|
|
134
|
-
}
|
|
135
|
-
submitLabel={secondFactor ? t`Confirm` : t`Sign in`}
|
|
136
|
-
onSubmit={doSubmit}
|
|
137
|
-
>
|
|
138
|
-
<Fieldset disabled={loading} label={<Trans>Account</Trans>}>
|
|
139
|
-
<InputText
|
|
140
|
-
icon={<AtSymbolIcon className="w-5" />}
|
|
141
|
-
name="username"
|
|
142
|
-
type="text"
|
|
143
|
-
title={t`Username or email address`}
|
|
144
|
-
autoCapitalize="none"
|
|
145
|
-
autoCorrect="off"
|
|
146
|
-
autoComplete="username"
|
|
147
|
-
spellCheck="false"
|
|
148
|
-
dir="auto"
|
|
149
|
-
enterKeyHint="next"
|
|
150
|
-
required
|
|
151
|
-
readOnly={usernameReadonly}
|
|
152
|
-
disabled={usernameReadonly}
|
|
153
|
-
autoFocus
|
|
154
|
-
value={username}
|
|
155
|
-
onChange={(event) => {
|
|
156
|
-
resetState()
|
|
157
|
-
setUsername(event.target.value)
|
|
158
|
-
}}
|
|
159
|
-
/>
|
|
160
|
-
</Fieldset>
|
|
161
|
-
|
|
162
|
-
<InputPassword
|
|
163
|
-
name="password"
|
|
164
|
-
onChange={(event) => {
|
|
165
|
-
resetState()
|
|
166
|
-
setPassword(event.target.value)
|
|
167
|
-
}}
|
|
168
|
-
append={
|
|
169
|
-
onForgotPassword && (
|
|
170
|
-
<Button
|
|
171
|
-
className="text-sm"
|
|
172
|
-
type="button"
|
|
173
|
-
onClick={() => {
|
|
174
|
-
onForgotPassword(username?.includes('@') ? username : undefined)
|
|
175
|
-
}}
|
|
176
|
-
aria-label={t`Reset your password`}
|
|
177
|
-
>
|
|
178
|
-
<Trans>Forgot?</Trans>
|
|
179
|
-
</Button>
|
|
180
|
-
)
|
|
181
|
-
}
|
|
182
|
-
enterKeyHint={secondFactor ? 'next' : 'done'}
|
|
183
|
-
disabled={loading}
|
|
184
|
-
required
|
|
185
|
-
/>
|
|
186
|
-
|
|
187
|
-
<Admonition role="status">
|
|
188
|
-
<p className="font-bold text-md text-brand pb-1">
|
|
189
|
-
<Trans>Warning</Trans>
|
|
190
|
-
</p>
|
|
191
|
-
<p className="text-sm">
|
|
192
|
-
<Trans>
|
|
193
|
-
Please verify the domain name of the website before entering your
|
|
194
|
-
password. Never enter your password on a domain you do not trust.
|
|
195
|
-
</Trans>
|
|
196
|
-
</p>
|
|
197
|
-
</Admonition>
|
|
198
|
-
|
|
199
|
-
<Fieldset
|
|
200
|
-
key="remember"
|
|
201
|
-
disabled={loading}
|
|
202
|
-
label={<Trans>Session</Trans>}
|
|
203
|
-
>
|
|
204
|
-
<InputCheckbox
|
|
205
|
-
name="remember"
|
|
206
|
-
title={t`Remember this account on this device`}
|
|
207
|
-
enterKeyHint={secondFactor ? 'next' : 'done'}
|
|
208
|
-
checked={remember}
|
|
209
|
-
onChange={(event) => setRemember(event.target.checked)}
|
|
210
|
-
>
|
|
211
|
-
<Trans>Remember this account on this device</Trans>
|
|
212
|
-
</InputCheckbox>
|
|
213
|
-
</Fieldset>
|
|
214
|
-
|
|
215
|
-
{secondFactor && (
|
|
216
|
-
<Fieldset
|
|
217
|
-
key="2fa"
|
|
218
|
-
disabled={loading}
|
|
219
|
-
label={<Trans>2FA Confirmation</Trans>}
|
|
220
|
-
>
|
|
221
|
-
<div>
|
|
222
|
-
<InputToken
|
|
223
|
-
title={t`Confirmation code`}
|
|
224
|
-
enterKeyHint="done"
|
|
225
|
-
required
|
|
226
|
-
autoFocus={true}
|
|
227
|
-
value={otp ?? ''}
|
|
228
|
-
onToken={setOtp}
|
|
229
|
-
/>
|
|
230
|
-
|
|
231
|
-
<p className="text-slate-600 dark:text-slate-400 text-sm">
|
|
232
|
-
<Trans>
|
|
233
|
-
Check your {secondFactor.hint} email for a login code and enter
|
|
234
|
-
it here.
|
|
235
|
-
</Trans>
|
|
236
|
-
</p>
|
|
237
|
-
</div>
|
|
238
|
-
</Fieldset>
|
|
239
|
-
)}
|
|
240
|
-
</FormCardAsync>
|
|
241
|
-
)
|
|
242
|
-
}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Trans, useLingui } from '@lingui/react/macro'
|
|
2
|
-
import type { Account } from '@atproto/oauth-provider-api'
|
|
3
|
-
import { Button } from '../../../components/forms/button.tsx'
|
|
4
|
-
import {
|
|
5
|
-
FormCard,
|
|
6
|
-
FormCardProps,
|
|
7
|
-
} from '../../../components/forms/form-card.tsx'
|
|
8
|
-
import { InputContainer } from '../../../components/forms/input-container.tsx'
|
|
9
|
-
import { AccountImage } from '../../../components/utils/account-image.tsx'
|
|
10
|
-
import {
|
|
11
|
-
AtSymbolIcon,
|
|
12
|
-
CaretRightIcon,
|
|
13
|
-
} from '../../../components/utils/icons.tsx'
|
|
14
|
-
import { Override } from '../../../lib/util.ts'
|
|
15
|
-
|
|
16
|
-
export type SignInPickerProps = Override<
|
|
17
|
-
Omit<FormCardProps, 'cancel' | 'actions' | 'append'>,
|
|
18
|
-
{
|
|
19
|
-
accounts: readonly Account[]
|
|
20
|
-
|
|
21
|
-
onAccount: (account: Account) => void
|
|
22
|
-
onOther?: () => void
|
|
23
|
-
onBack?: () => void
|
|
24
|
-
}
|
|
25
|
-
>
|
|
26
|
-
|
|
27
|
-
export function SignInPicker({
|
|
28
|
-
accounts,
|
|
29
|
-
|
|
30
|
-
onAccount,
|
|
31
|
-
onOther = undefined,
|
|
32
|
-
onBack,
|
|
33
|
-
|
|
34
|
-
// FormCard
|
|
35
|
-
children,
|
|
36
|
-
...props
|
|
37
|
-
}: SignInPickerProps) {
|
|
38
|
-
const { t } = useLingui()
|
|
39
|
-
return (
|
|
40
|
-
<FormCard
|
|
41
|
-
{...props}
|
|
42
|
-
append={children}
|
|
43
|
-
actions={null}
|
|
44
|
-
cancel={
|
|
45
|
-
onBack && (
|
|
46
|
-
<Button onClick={onBack}>
|
|
47
|
-
<Trans>Back</Trans>
|
|
48
|
-
</Button>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
>
|
|
52
|
-
<p className="text-slate-600 dark:text-slate-400 text-sm font-medium">
|
|
53
|
-
<Trans>Sign in as...</Trans>
|
|
54
|
-
</p>
|
|
55
|
-
|
|
56
|
-
{accounts.map((account) => {
|
|
57
|
-
const [name, identifier] = [
|
|
58
|
-
account.name,
|
|
59
|
-
account.preferred_username,
|
|
60
|
-
account.email,
|
|
61
|
-
account.sub,
|
|
62
|
-
].filter(Boolean) as [string, string?]
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<InputContainer
|
|
66
|
-
tabIndex={0}
|
|
67
|
-
key={account.sub}
|
|
68
|
-
onKeyDown={(event) => {
|
|
69
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
70
|
-
onAccount(account)
|
|
71
|
-
}
|
|
72
|
-
}}
|
|
73
|
-
onClick={() => onAccount(account)}
|
|
74
|
-
role="button"
|
|
75
|
-
aria-label={t`Sign in as ${account.name}`}
|
|
76
|
-
icon={<AccountImage src={account.picture} alt={name} />}
|
|
77
|
-
append={<CaretRightIcon aria-hidden className="h-4" />}
|
|
78
|
-
>
|
|
79
|
-
<span className="flex flex-wrap items-center">
|
|
80
|
-
<span className="font-medium truncate mr-2" arial-label={t`Name`}>
|
|
81
|
-
{name}
|
|
82
|
-
</span>
|
|
83
|
-
{identifier && (
|
|
84
|
-
<span
|
|
85
|
-
className="text-sm text-neutral-500 dark:text-neutral-400 truncate"
|
|
86
|
-
arial-label={t`Identifier`}
|
|
87
|
-
>
|
|
88
|
-
{identifier}
|
|
89
|
-
</span>
|
|
90
|
-
)}
|
|
91
|
-
</span>
|
|
92
|
-
</InputContainer>
|
|
93
|
-
)
|
|
94
|
-
})}
|
|
95
|
-
|
|
96
|
-
{onOther && (
|
|
97
|
-
<InputContainer
|
|
98
|
-
key="other"
|
|
99
|
-
tabIndex={0}
|
|
100
|
-
onKeyDown={(event) => {
|
|
101
|
-
if (event.key === 'Enter' || event.key === ' ') onOther()
|
|
102
|
-
}}
|
|
103
|
-
onClick={onOther}
|
|
104
|
-
aria-label={t`Login to account that is not listed`}
|
|
105
|
-
role="button"
|
|
106
|
-
append={<CaretRightIcon aria-hidden className="h-4" />}
|
|
107
|
-
icon={<AtSymbolIcon aria-hidden className="h-4" />}
|
|
108
|
-
>
|
|
109
|
-
<span className="truncate text-slate-700 dark:text-slate-400">
|
|
110
|
-
<Trans>Another account</Trans>
|
|
111
|
-
</span>
|
|
112
|
-
</InputContainer>
|
|
113
|
-
)}
|
|
114
|
-
</FormCard>
|
|
115
|
-
)
|
|
116
|
-
}
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { Trans, useLingui } from '@lingui/react/macro'
|
|
2
|
-
import { useCallback, useEffect, useMemo, useState } from 'react'
|
|
3
|
-
import type { Session } from '@atproto/oauth-provider-api'
|
|
4
|
-
import {
|
|
5
|
-
LayoutTitlePage,
|
|
6
|
-
LayoutTitlePageProps,
|
|
7
|
-
} from '../../../components/layouts/layout-title-page.tsx'
|
|
8
|
-
import { Override } from '../../../lib/util.ts'
|
|
9
|
-
import { SignInForm, SignInFormOutput } from './sign-in-form.tsx'
|
|
10
|
-
import { SignInPicker } from './sign-in-picker.tsx'
|
|
11
|
-
|
|
12
|
-
export type SignInViewProps = Override<
|
|
13
|
-
LayoutTitlePageProps,
|
|
14
|
-
{
|
|
15
|
-
sessions: readonly Session[]
|
|
16
|
-
selectSub: (sub: string | null) => void
|
|
17
|
-
loginHint?: string
|
|
18
|
-
|
|
19
|
-
onSignIn: (
|
|
20
|
-
credentials: SignInFormOutput,
|
|
21
|
-
signal: AbortSignal,
|
|
22
|
-
) => void | PromiseLike<void>
|
|
23
|
-
onForgotPassword?: (emailHint?: string) => void
|
|
24
|
-
onBack?: () => void
|
|
25
|
-
}
|
|
26
|
-
>
|
|
27
|
-
|
|
28
|
-
export function SignInView({
|
|
29
|
-
loginHint,
|
|
30
|
-
sessions,
|
|
31
|
-
selectSub,
|
|
32
|
-
|
|
33
|
-
onSignIn,
|
|
34
|
-
onForgotPassword,
|
|
35
|
-
onBack,
|
|
36
|
-
|
|
37
|
-
// LayoutTitlePage
|
|
38
|
-
title,
|
|
39
|
-
subtitle,
|
|
40
|
-
...props
|
|
41
|
-
}: SignInViewProps) {
|
|
42
|
-
const { t } = useLingui()
|
|
43
|
-
const session = useMemo(() => sessions.find((s) => s.selected), [sessions])
|
|
44
|
-
const clearSession = useCallback(() => selectSub(null), [selectSub])
|
|
45
|
-
const accounts = useMemo(() => sessions.map((s) => s.account), [sessions])
|
|
46
|
-
const [showSignInForm, setShowSignInForm] = useState(sessions.length === 0)
|
|
47
|
-
|
|
48
|
-
title ??= t`Sign in`
|
|
49
|
-
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
// Make sure the "back" action shows the account picker instead of the
|
|
52
|
-
// sign-in form (since the account was added to the list of current
|
|
53
|
-
// sessions).
|
|
54
|
-
if (session) setShowSignInForm(false)
|
|
55
|
-
}, [session])
|
|
56
|
-
|
|
57
|
-
if (session) {
|
|
58
|
-
// All set (parent view will handle the redirect)
|
|
59
|
-
if (!session.loginRequired) return null
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<LayoutTitlePage
|
|
63
|
-
{...props}
|
|
64
|
-
title={title}
|
|
65
|
-
subtitle={subtitle ?? <Trans>Confirm your password to continue</Trans>}
|
|
66
|
-
>
|
|
67
|
-
<SignInForm
|
|
68
|
-
onSubmit={onSignIn}
|
|
69
|
-
onForgotPassword={onForgotPassword}
|
|
70
|
-
onBack={clearSession}
|
|
71
|
-
usernameDefault={
|
|
72
|
-
session.account.preferred_username || session.account.sub
|
|
73
|
-
}
|
|
74
|
-
usernameReadonly={true}
|
|
75
|
-
rememberDefault={true}
|
|
76
|
-
/>
|
|
77
|
-
</LayoutTitlePage>
|
|
78
|
-
)
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (loginHint) {
|
|
82
|
-
return (
|
|
83
|
-
<LayoutTitlePage
|
|
84
|
-
{...props}
|
|
85
|
-
title={title}
|
|
86
|
-
subtitle={subtitle ?? <Trans>Enter your password</Trans>}
|
|
87
|
-
>
|
|
88
|
-
<SignInForm
|
|
89
|
-
onSubmit={onSignIn}
|
|
90
|
-
onForgotPassword={onForgotPassword}
|
|
91
|
-
onBack={onBack}
|
|
92
|
-
usernameDefault={loginHint}
|
|
93
|
-
usernameReadonly={true}
|
|
94
|
-
/>
|
|
95
|
-
</LayoutTitlePage>
|
|
96
|
-
)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (sessions.length === 0) {
|
|
100
|
-
return (
|
|
101
|
-
<LayoutTitlePage
|
|
102
|
-
{...props}
|
|
103
|
-
title={title}
|
|
104
|
-
subtitle={subtitle ?? <Trans>Enter your username and password</Trans>}
|
|
105
|
-
>
|
|
106
|
-
<SignInForm
|
|
107
|
-
onSubmit={onSignIn}
|
|
108
|
-
onForgotPassword={onForgotPassword}
|
|
109
|
-
onBack={onBack}
|
|
110
|
-
/>
|
|
111
|
-
</LayoutTitlePage>
|
|
112
|
-
)
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (showSignInForm) {
|
|
116
|
-
return (
|
|
117
|
-
<LayoutTitlePage
|
|
118
|
-
{...props}
|
|
119
|
-
title={title}
|
|
120
|
-
subtitle={subtitle ?? <Trans>Enter your username and password</Trans>}
|
|
121
|
-
>
|
|
122
|
-
<SignInForm
|
|
123
|
-
onSubmit={onSignIn}
|
|
124
|
-
onForgotPassword={onForgotPassword}
|
|
125
|
-
onBack={() => setShowSignInForm(false)}
|
|
126
|
-
/>
|
|
127
|
-
</LayoutTitlePage>
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return (
|
|
132
|
-
<LayoutTitlePage
|
|
133
|
-
{...props}
|
|
134
|
-
title={title}
|
|
135
|
-
subtitle={subtitle ?? <Trans>Select from an existing account</Trans>}
|
|
136
|
-
>
|
|
137
|
-
<SignInPicker
|
|
138
|
-
accounts={accounts}
|
|
139
|
-
onAccount={(a) => selectSub(a.sub)}
|
|
140
|
-
onOther={() => setShowSignInForm(true)}
|
|
141
|
-
onBack={onBack}
|
|
142
|
-
/>
|
|
143
|
-
</LayoutTitlePage>
|
|
144
|
-
)
|
|
145
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { Trans, useLingui } from '@lingui/react/macro'
|
|
2
|
-
import { ReactNode, useEffect, useMemo, useRef, useState } from 'react'
|
|
3
|
-
import { Fieldset } from '../../../components/forms/fieldset.tsx'
|
|
4
|
-
import {
|
|
5
|
-
AsyncActionController,
|
|
6
|
-
FormCardAsync,
|
|
7
|
-
FormCardAsyncProps,
|
|
8
|
-
} from '../../../components/forms/form-card-async.tsx'
|
|
9
|
-
import { InputEmailAddress } from '../../../components/forms/input-email-address.tsx'
|
|
10
|
-
import { InputNewPassword } from '../../../components/forms/input-new-password.tsx'
|
|
11
|
-
import { InputText } from '../../../components/forms/input-text.tsx'
|
|
12
|
-
import { TokenIcon } from '../../../components/utils/icons.tsx'
|
|
13
|
-
import { mergeRefs } from '../../../lib/ref.ts'
|
|
14
|
-
import { Override } from '../../../lib/util.ts'
|
|
15
|
-
|
|
16
|
-
export type SignUpAccountFormOutput = {
|
|
17
|
-
email: string
|
|
18
|
-
password: string
|
|
19
|
-
inviteCode?: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type SignUpAccountFormProps = Override<
|
|
23
|
-
Omit<
|
|
24
|
-
FormCardAsyncProps,
|
|
25
|
-
'append' | 'onCancel' | 'onSubmit' | 'submitLabel' | 'cancelLabel'
|
|
26
|
-
>,
|
|
27
|
-
{
|
|
28
|
-
inviteCodeRequired?: boolean
|
|
29
|
-
|
|
30
|
-
credentials?: SignUpAccountFormOutput
|
|
31
|
-
onCredentials?: (credentials?: SignUpAccountFormOutput) => void
|
|
32
|
-
|
|
33
|
-
onNext: (signal: AbortSignal) => void | PromiseLike<void>
|
|
34
|
-
nextLabel?: ReactNode
|
|
35
|
-
|
|
36
|
-
onPrev?: () => void
|
|
37
|
-
prevLabel?: ReactNode
|
|
38
|
-
}
|
|
39
|
-
>
|
|
40
|
-
|
|
41
|
-
export function SignUpAccountForm({
|
|
42
|
-
inviteCodeRequired = true,
|
|
43
|
-
|
|
44
|
-
credentials: creds,
|
|
45
|
-
onCredentials,
|
|
46
|
-
|
|
47
|
-
onNext,
|
|
48
|
-
nextLabel,
|
|
49
|
-
|
|
50
|
-
onPrev,
|
|
51
|
-
prevLabel,
|
|
52
|
-
|
|
53
|
-
// FormCardAsyncProps
|
|
54
|
-
children,
|
|
55
|
-
ref,
|
|
56
|
-
invalid,
|
|
57
|
-
...props
|
|
58
|
-
}: SignUpAccountFormProps) {
|
|
59
|
-
const { t } = useLingui()
|
|
60
|
-
|
|
61
|
-
const [email, setEmail] = useState(creds?.email)
|
|
62
|
-
const [password, setPassword] = useState(creds?.password)
|
|
63
|
-
const [inviteCode, setInviteCode] = useState(creds?.inviteCode)
|
|
64
|
-
|
|
65
|
-
const formRef = useRef<AsyncActionController>(null)
|
|
66
|
-
const resetForm = () => formRef.current?.reset()
|
|
67
|
-
|
|
68
|
-
const credentials = useMemo(
|
|
69
|
-
() =>
|
|
70
|
-
email && password && (!inviteCodeRequired || inviteCode)
|
|
71
|
-
? {
|
|
72
|
-
email,
|
|
73
|
-
password,
|
|
74
|
-
inviteCode: inviteCodeRequired ? inviteCode : undefined,
|
|
75
|
-
}
|
|
76
|
-
: undefined,
|
|
77
|
-
[email, password, inviteCode, inviteCodeRequired],
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
onCredentials?.(credentials)
|
|
82
|
-
}, [credentials, onCredentials])
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<FormCardAsync
|
|
86
|
-
{...props}
|
|
87
|
-
ref={mergeRefs([ref, formRef])}
|
|
88
|
-
invalid={invalid || !credentials}
|
|
89
|
-
onCancel={onPrev}
|
|
90
|
-
cancelLabel={prevLabel}
|
|
91
|
-
onSubmit={onNext}
|
|
92
|
-
submitLabel={nextLabel}
|
|
93
|
-
append={children}
|
|
94
|
-
>
|
|
95
|
-
{inviteCodeRequired && (
|
|
96
|
-
<Fieldset label={<Trans>Invite code</Trans>}>
|
|
97
|
-
<InputText
|
|
98
|
-
icon={<TokenIcon className="w-5" />}
|
|
99
|
-
autoFocus
|
|
100
|
-
name="inviteCode"
|
|
101
|
-
title={t`Invite code`}
|
|
102
|
-
placeholder={t`example-com-xxxxx-xxxxx`}
|
|
103
|
-
required
|
|
104
|
-
value={inviteCode || ''}
|
|
105
|
-
onChange={(event) => {
|
|
106
|
-
setInviteCode(event.target.value || undefined)
|
|
107
|
-
resetForm()
|
|
108
|
-
}}
|
|
109
|
-
enterKeyHint="next"
|
|
110
|
-
/>
|
|
111
|
-
</Fieldset>
|
|
112
|
-
)}
|
|
113
|
-
|
|
114
|
-
<Fieldset label={<Trans>Email</Trans>}>
|
|
115
|
-
<InputEmailAddress
|
|
116
|
-
autoFocus={!inviteCodeRequired}
|
|
117
|
-
name="email"
|
|
118
|
-
enterKeyHint="next"
|
|
119
|
-
required
|
|
120
|
-
defaultValue={email}
|
|
121
|
-
onEmail={(email) => {
|
|
122
|
-
setEmail(email)
|
|
123
|
-
resetForm()
|
|
124
|
-
}}
|
|
125
|
-
/>
|
|
126
|
-
</Fieldset>
|
|
127
|
-
|
|
128
|
-
<Fieldset label={<Trans>Password</Trans>}>
|
|
129
|
-
<InputNewPassword
|
|
130
|
-
name="password"
|
|
131
|
-
enterKeyHint="next"
|
|
132
|
-
required
|
|
133
|
-
password={password}
|
|
134
|
-
onPassword={(value) => {
|
|
135
|
-
setPassword(value)
|
|
136
|
-
resetForm()
|
|
137
|
-
}}
|
|
138
|
-
/>
|
|
139
|
-
</Fieldset>
|
|
140
|
-
</FormCardAsync>
|
|
141
|
-
)
|
|
142
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Trans } from '@lingui/react/macro'
|
|
2
|
-
import { JSX } from 'react'
|
|
3
|
-
import type { LinkDefinition } from '@atproto/oauth-provider-api'
|
|
4
|
-
import { LinkAnchor } from '../../../components/utils/link-anchor.tsx'
|
|
5
|
-
import { clsx } from '../../../lib/clsx.ts'
|
|
6
|
-
import { Override } from '../../../lib/util.ts'
|
|
7
|
-
|
|
8
|
-
export type SignUpDisclaimerProps = Override<
|
|
9
|
-
Omit<JSX.IntrinsicElements['p'], 'children'>,
|
|
10
|
-
{
|
|
11
|
-
links?: readonly LinkDefinition[]
|
|
12
|
-
}
|
|
13
|
-
>
|
|
14
|
-
|
|
15
|
-
export function SignUpDisclaimer({
|
|
16
|
-
links,
|
|
17
|
-
|
|
18
|
-
// p
|
|
19
|
-
className,
|
|
20
|
-
...attrs
|
|
21
|
-
}: SignUpDisclaimerProps) {
|
|
22
|
-
const tosLink = links?.find((l) => l.rel === 'terms-of-service')
|
|
23
|
-
const ppLink = links?.find((l) => l.rel === 'privacy-policy')
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<p
|
|
27
|
-
className={clsx('text-sm text-slate-500 dark:text-slate-400', className)}
|
|
28
|
-
{...attrs}
|
|
29
|
-
>
|
|
30
|
-
<Trans>
|
|
31
|
-
By creating an account you agree to the{' '}
|
|
32
|
-
{tosLink ? (
|
|
33
|
-
<LinkAnchor className="text-brand underline" link={tosLink}>
|
|
34
|
-
<Trans>Terms of Service</Trans>
|
|
35
|
-
</LinkAnchor>
|
|
36
|
-
) : (
|
|
37
|
-
<Trans>Terms of Service</Trans>
|
|
38
|
-
)}
|
|
39
|
-
{' and the '}
|
|
40
|
-
{ppLink ? (
|
|
41
|
-
<LinkAnchor className="text-brand underline" link={ppLink}>
|
|
42
|
-
<Trans>Privacy Policy</Trans>
|
|
43
|
-
</LinkAnchor>
|
|
44
|
-
) : (
|
|
45
|
-
<Trans>Privacy Policy</Trans>
|
|
46
|
-
)}{' '}
|
|
47
|
-
of this service.
|
|
48
|
-
</Trans>
|
|
49
|
-
</p>
|
|
50
|
-
)
|
|
51
|
-
}
|