@springmicro/auth 0.1.8 → 0.2.0-alpha.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/README.md +20 -15
- package/dist/Index-652aeb8c-BTQ1rBi7.js +2818 -0
- package/dist/Index-c419311f-BOZhAAW3.js +1054 -0
- package/dist/Web3Auth-hACKSouN.js +32769 -0
- package/dist/alphawallet-B7eovdf-.js +26 -0
- package/dist/apexwallet-ysP20G9D.js +93 -0
- package/dist/atoken-BBnNTzcz.js +27 -0
- package/dist/bifrostwallet-CNNBO92h.js +11 -0
- package/dist/binance-DvPgAzCw.js +14 -0
- package/dist/bitget-DZOUrwgy.js +4 -0
- package/dist/bitpie-C_uxmEzw.js +25 -0
- package/dist/bitski-DpzkHNkv.js +4 -0
- package/dist/blockwallet-BL69cqkA.js +8 -0
- package/dist/brave-DnRzMQYW.js +35 -0
- package/dist/ccip-c78d2f16-DLcRlwod.js +165 -0
- package/dist/coin98wallet-CkFdOvXt.js +4 -0
- package/dist/coinbase-CaGNx5if.js +9 -0
- package/dist/core-9rK8tWud.js +7 -0
- package/dist/defiwallet-0AsgJBSy.js +10 -0
- package/dist/detected-CX_JZaUk.js +6 -0
- package/dist/echooo-CmaetT_Z.js +14 -0
- package/dist/enkrypt-BibtwvK7.js +20 -0
- package/dist/exodus-BxzkDWWP.js +4 -0
- package/dist/fordefi-CvKyVwhI.js +6 -0
- package/dist/foxwallet-D7c_LDTf.js +4 -0
- package/dist/frame-CDfNmjUy.js +7 -0
- package/dist/frontier-DqKNSj2z.js +8 -0
- package/dist/huobiwallet-CxSwqa5L.js +14 -0
- package/dist/hyperpay-nmHE3WqM.js +7 -0
- package/dist/icon-2Zqy7pqQ.js +8 -0
- package/dist/icon-CGWI1Ies.js +43 -0
- package/dist/icon-C_O4nprO.js +9 -0
- package/dist/icon-DbgmZCnU.js +9 -0
- package/dist/icon-cAd7RhSC.js +9 -0
- package/dist/icon-duCa3gfT.js +11 -0
- package/dist/imtoken-yENtOTS3.js +17 -0
- package/dist/index-021f6a62-Zz543EDB.js +2583 -0
- package/dist/index-40a497ea-Bn2mC0r7.js +1010 -0
- package/dist/index-BHkXn9Ss.js +4010 -0
- package/dist/index-BaYEABY7.js +7089 -0
- package/dist/index-BtLU53lm.js +6023 -0
- package/dist/index-CynP9H3X.js +6188 -0
- package/dist/index-Dg8m-Szw.js +31 -0
- package/dist/index-Dt6M8ha9.js +161 -0
- package/dist/index-DtJfAdfq.js +5822 -0
- package/dist/index-klU8YB0c.js +1983 -0
- package/dist/index.d.ts +124 -0
- package/dist/index.js +5 -43
- package/dist/index.umd.cjs +1937 -1
- package/dist/infinitywallet-C8J4FUYw.js +42 -0
- package/dist/kayros-AIrUK1za.js +27 -0
- package/dist/lif3wallet-C5D6r8pg.js +41 -0
- package/dist/liquality-nbCtErVq.js +16 -0
- package/dist/mathwallet-CWkivCXo.js +50 -0
- package/dist/meetone-kKmvI8md.js +13 -0
- package/dist/metamask-BN7yiDV1.js +64 -0
- package/dist/mykey-CQZ6UcLH.js +13 -0
- package/dist/number-BXHWhlom.js +1529 -0
- package/dist/okxwallet-CJLVogh2.js +8 -0
- package/dist/oneInch-CciyZ4Pz.js +72 -0
- package/dist/onekey-Dal8kYjU.js +9 -0
- package/dist/opera-DnKg-TJU.js +24 -0
- package/dist/ownbit-BshJUVuW.js +18 -0
- package/dist/phantom-CJ8dIcov.js +35 -0
- package/dist/rabby-D4thTcd6.js +27 -0
- package/dist/rainbow-mXld6yWV.js +69 -0
- package/dist/roninwallet-ZyYrd-D1.js +9 -0
- package/dist/safeheron-Eg1Jb29V.js +23 -0
- package/dist/safepal-DVIKy94N.js +105 -0
- package/dist/sequence-BS2IbtDg.js +70 -0
- package/dist/stablewallet-jyB079Wb.js +20 -0
- package/dist/status-FrAvQjfn.js +4 -0
- package/dist/subwallet-DMvFqKyY.js +25 -0
- package/dist/talisman-Bp8zUXqB.js +16 -0
- package/dist/tallywallet-B4OS9nIr.js +16 -0
- package/dist/tokenary-C7jjcbQa.js +18 -0
- package/dist/tokenpocket-9ZRPmAFA.js +28 -0
- package/dist/tp-V2em5bdl.js +13 -0
- package/dist/transactionRequest-be6a8ea9-CUKWo5mx.js +1117 -0
- package/dist/trust-gPypS1O7.js +11 -0
- package/dist/xdefi-COVIyGz4.js +38 -0
- package/dist/zeal-DxHbDqm0.js +9 -0
- package/dist/zerion-BfW0UElc.js +8 -0
- package/dist/zodiacpilot-CrId6F4w.js +6 -0
- package/package.json +35 -15
- package/src/auth/config.ts +0 -2
- package/src/components/SignUp.tsx +442 -0
- package/src/components/forms/AgreementModal.tsx +88 -0
- package/src/components/forms/CaptchaController.tsx +94 -0
- package/src/components/forms/CaptchaModal.jsx +171 -0
- package/src/components/forms/CaptchaWidget.jsx +146 -0
- package/src/components/forms/PasswordChecker.ts +88 -0
- package/src/components/forms/SendCodeInput.tsx +149 -0
- package/src/components/forms/SignUpFormItem.tsx +704 -0
- package/src/components/forms/util/application-api.ts +155 -0
- package/src/components/forms/util/auth-api.ts +198 -0
- package/src/components/forms/util/auth-util.tsx +346 -0
- package/src/components/forms/util/core.ts +493 -0
- package/src/components/forms/util/invitation-api.ts +132 -0
- package/src/components/forms/util/provider.tsx +603 -0
- package/src/components/forms/util/user-api.ts +303 -0
- package/src/components/provider/AdfsLoginButton.jsx +38 -0
- package/src/components/provider/AlipayLoginButton.jsx +38 -0
- package/src/components/provider/AppleLoginButton.jsx +38 -0
- package/src/components/provider/AzureADB2CLoginButton.jsx +38 -0
- package/src/components/provider/AzureADLoginButton.jsx +38 -0
- package/src/components/provider/BaiduLoginButton.jsx +38 -0
- package/src/components/provider/BilibiliLoginButton.jsx +37 -0
- package/src/components/provider/CasdoorLoginButton.jsx +38 -0
- package/src/components/provider/DingTalkLoginButton.jsx +37 -0
- package/src/components/provider/DouyinLoginButton.jsx +38 -0
- package/src/components/provider/FacebookLoginButton.jsx +37 -0
- package/src/components/provider/GitHubLoginButton.jsx +37 -0
- package/src/components/provider/GitLabLoginButton.jsx +38 -0
- package/src/components/provider/GiteeLoginButton.jsx +34 -0
- package/src/components/provider/GoogleLoginButton.jsx +68 -0
- package/src/components/provider/InfoflowLoginButton.jsx +38 -0
- package/src/components/provider/LarkLoginButton.jsx +38 -0
- package/src/components/provider/LinkedInLoginButton.jsx +37 -0
- package/src/components/provider/LoginButton.jsx +33 -0
- package/src/components/provider/OktaLoginButton.jsx +38 -0
- package/src/components/provider/Provider.jsx +3 -0
- package/src/components/provider/ProviderButton.jsx +327 -0
- package/src/components/provider/QqLoginButton.jsx +31 -0
- package/src/components/provider/SelfLoginButton.jsx +47 -0
- package/src/components/provider/SlackLoginButton.jsx +38 -0
- package/src/components/provider/SteamLoginButton.jsx +38 -0
- package/src/components/provider/WeComLoginButton.jsx +34 -0
- package/src/components/provider/Web3Auth.jsx +365 -0
- package/src/components/provider/WechatLoginButton.jsx +37 -0
- package/src/components/provider/WeiboLoginButton.jsx +34 -0
- package/src/components/util.tsx +173 -0
- package/src/i18n/en/signup.json +48 -0
- package/src/i18n/index.ts +17 -0
- package/src/index.tsx +6 -1
- package/vite.config.ts +33 -25
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// Copyright 2021 The Casdoor Authors. All Rights Reserved.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
import React from "react";
|
|
16
|
+
import i18next from "i18next";
|
|
17
|
+
import * as UserBackend from "./util/user-api";
|
|
18
|
+
import { CaptchaModal } from "./CaptchaModal";
|
|
19
|
+
import type { Application } from "./util/provider";
|
|
20
|
+
import { useTranslation } from "react-i18next";
|
|
21
|
+
|
|
22
|
+
type ButtonClickArgsTuple = [
|
|
23
|
+
dest: any,
|
|
24
|
+
type: any,
|
|
25
|
+
applicationId: any,
|
|
26
|
+
checkUser?: string,
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
export type SendCodeInputProps = {
|
|
30
|
+
value?: any;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
textBefore?: string;
|
|
33
|
+
onChange: Function;
|
|
34
|
+
onButtonClickArgs: ButtonClickArgsTuple;
|
|
35
|
+
application: Application;
|
|
36
|
+
method: string;
|
|
37
|
+
countryCode: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const SendCodeInput = ({
|
|
41
|
+
value,
|
|
42
|
+
disabled,
|
|
43
|
+
textBefore,
|
|
44
|
+
onChange,
|
|
45
|
+
onButtonClickArgs,
|
|
46
|
+
application,
|
|
47
|
+
method,
|
|
48
|
+
countryCode,
|
|
49
|
+
}: SendCodeInputProps) => {
|
|
50
|
+
const { t } = useTranslation();
|
|
51
|
+
const [visible, setVisible] = React.useState(false);
|
|
52
|
+
const [buttonLeftTime, setButtonLeftTime] = React.useState(0);
|
|
53
|
+
const [buttonLoading, setButtonLoading] = React.useState(false);
|
|
54
|
+
const dialogRef = React.useRef<HTMLElement | null>(null);
|
|
55
|
+
|
|
56
|
+
const handleCountDown = (leftTime = 60) => {
|
|
57
|
+
let leftTimeSecond = leftTime;
|
|
58
|
+
setButtonLeftTime(leftTimeSecond);
|
|
59
|
+
const countDown = () => {
|
|
60
|
+
leftTimeSecond--;
|
|
61
|
+
setButtonLeftTime(leftTimeSecond);
|
|
62
|
+
if (leftTimeSecond === 0) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
setTimeout(countDown, 1000);
|
|
66
|
+
};
|
|
67
|
+
setTimeout(countDown, 1000);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const handleOk = (
|
|
71
|
+
captchaType: string,
|
|
72
|
+
captchaToken: string,
|
|
73
|
+
clientSecret: string
|
|
74
|
+
) => {
|
|
75
|
+
setVisible(false);
|
|
76
|
+
setButtonLoading(true);
|
|
77
|
+
UserBackend.sendCode(
|
|
78
|
+
captchaType,
|
|
79
|
+
captchaToken,
|
|
80
|
+
clientSecret,
|
|
81
|
+
method,
|
|
82
|
+
countryCode,
|
|
83
|
+
...onButtonClickArgs
|
|
84
|
+
).then((res: any) => {
|
|
85
|
+
setButtonLoading(false);
|
|
86
|
+
if (res) {
|
|
87
|
+
handleCountDown(60);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const handleCancel = () => {
|
|
93
|
+
setVisible(false);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
React.useEffect(() => {
|
|
97
|
+
dialogRef.current = document.getElementById("captcha-modal");
|
|
98
|
+
}, []);
|
|
99
|
+
|
|
100
|
+
React.useEffect(() => {
|
|
101
|
+
if (dialogRef.current) {
|
|
102
|
+
if (visible) {
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
dialogRef.current.showModal();
|
|
105
|
+
} else {
|
|
106
|
+
// @ts-ignore
|
|
107
|
+
dialogRef.current.close();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}, [visible]);
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<React.Fragment>
|
|
114
|
+
<div className="flex">
|
|
115
|
+
<input
|
|
116
|
+
className="input"
|
|
117
|
+
// addonBefore={textBefore}
|
|
118
|
+
disabled={disabled}
|
|
119
|
+
value={value}
|
|
120
|
+
// prefix={<SafetyOutlined />}
|
|
121
|
+
placeholder={"Enter your code"}
|
|
122
|
+
onChange={(e: any) => onChange(e.target.value)}
|
|
123
|
+
// onBlur={() => setVisible(true)}
|
|
124
|
+
autoComplete="one-time-code"
|
|
125
|
+
/>
|
|
126
|
+
<button
|
|
127
|
+
className="btn"
|
|
128
|
+
disabled={disabled || buttonLeftTime > 0}
|
|
129
|
+
// loading={buttonLoading}
|
|
130
|
+
onClick={() => setVisible(true)}
|
|
131
|
+
>
|
|
132
|
+
{buttonLeftTime > 0
|
|
133
|
+
? `${buttonLeftTime} s`
|
|
134
|
+
: buttonLoading
|
|
135
|
+
? t("code.sending")
|
|
136
|
+
: t("code.sendCode")}
|
|
137
|
+
</button>
|
|
138
|
+
</div>
|
|
139
|
+
<CaptchaModal
|
|
140
|
+
owner={application.owner}
|
|
141
|
+
name={application.name}
|
|
142
|
+
visible={visible}
|
|
143
|
+
onOk={handleOk}
|
|
144
|
+
onCancel={handleCancel}
|
|
145
|
+
isCurrentProvider={false}
|
|
146
|
+
/>
|
|
147
|
+
</React.Fragment>
|
|
148
|
+
);
|
|
149
|
+
};
|