@springmicro/auth 0.5.3 → 0.5.5
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/{Index-64ac63ff-CSMaEBDA.js → Index-64ac63ff-C7Av5-xP.js} +1 -1
- package/dist/{Index-6c094240-mSgidTC1.js → Index-6c094240-BCXMyaWx.js} +1 -1
- package/dist/{Web3Auth-R27O2eCc.js → Web3Auth-hzrmIcT1.js} +10 -10
- package/dist/{hashMessage-B7KFzddV.js → hashMessage-DysoAmGZ.js} +1 -1
- package/dist/{index-ChYsa81u.js → index-BeiBc_gv.js} +2 -2
- package/dist/{index-TsElTuix.js → index-C2eVtjVv.js} +1 -1
- package/dist/{index-C8xLRoDS.js → index-DUwhqFWy.js} +1 -1
- package/dist/{index-1HLXgKdW.js → index-DXfwe7Zk.js} +2 -2
- package/dist/{index-D_yyUC2r.js → index-DYTvS1uk.js} +1033 -1063
- package/dist/{index-ayOaYQgv.js → index-Da0T7bYG.js} +4 -4
- package/dist/{index-Cp0Pai1C.js → index-LO_EWnJy.js} +1 -1
- package/dist/index.d.ts +3 -5
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +37 -37
- package/dist/{number-D9Q-3_Cz.js → number-CYbm8TMo.js} +1 -1
- package/package.json +2 -2
- package/src/components/SignUp.tsx +34 -61
- package/src/components/forms/SendCodeInput.tsx +2 -8
- package/src/components/forms/SignUpFormItem.tsx +1 -5
- package/src/components/forms/util/application-api.ts +2 -8
- package/src/components/forms/util/user-api.ts +4 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as D, t as ue, q as h, B as f, o as He, s as I, y as ce, C as ze, u as je, d as P, n as w, f as $, g as U, e as te } from "./Web3Auth-
|
|
1
|
+
import { i as D, t as ue, q as h, B as f, o as He, s as I, y as ce, C as ze, u as je, d as P, n as w, f as $, g as U, e as te } from "./Web3Auth-hzrmIcT1.js";
|
|
2
2
|
function A(e) {
|
|
3
3
|
if (!Number.isSafeInteger(e) || e < 0)
|
|
4
4
|
throw new Error(`Wrong positive integer: ${e}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@springmicro/auth",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"react-social-login-buttons": "^4.1.0",
|
|
55
55
|
"uuid": "^9.0.1"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "9ccb87063f4e9e3a6b51bf48c27c1323b3de2858"
|
|
58
58
|
}
|
|
@@ -49,8 +49,6 @@ export type SignUpFormState = {
|
|
|
49
49
|
type SignUpFormProps = {
|
|
50
50
|
application: Application | null;
|
|
51
51
|
applicationName?: string;
|
|
52
|
-
CLIENT_ID: string;
|
|
53
|
-
CLIENT_SECRET: string;
|
|
54
52
|
|
|
55
53
|
// onUpdateAccount: (account: Account) => void;
|
|
56
54
|
onUpdateApplication: (application: Application | null) => void;
|
|
@@ -80,19 +78,16 @@ function SignUpForm(props: SignUpFormProps) {
|
|
|
80
78
|
return;
|
|
81
79
|
}
|
|
82
80
|
|
|
83
|
-
ApplicationBackend.getApplication(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (res.status === "error") {
|
|
90
|
-
Setting.showMessage("error", res.msg);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
81
|
+
ApplicationBackend.getApplication("admin", applicationName).then(
|
|
82
|
+
(res: any) => {
|
|
83
|
+
if (res.status === "error") {
|
|
84
|
+
Setting.showMessage("error", res.msg);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
93
87
|
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
onUpdateApplication(res.data);
|
|
89
|
+
}
|
|
90
|
+
);
|
|
96
91
|
};
|
|
97
92
|
const getApplicationLogin = (oAuthParams: any) => {
|
|
98
93
|
AuthBackend.getApplicationLogin(oAuthParams).then((res) => {
|
|
@@ -181,15 +176,7 @@ function SignUpForm(props: SignUpFormProps) {
|
|
|
181
176
|
return application.signupItems?.map((signupItem, idx) => {
|
|
182
177
|
return (
|
|
183
178
|
<div key={idx}>
|
|
184
|
-
{renderFormItem(
|
|
185
|
-
application,
|
|
186
|
-
signupItem,
|
|
187
|
-
state,
|
|
188
|
-
setState,
|
|
189
|
-
t,
|
|
190
|
-
props.CLIENT_ID,
|
|
191
|
-
props.CLIENT_SECRET
|
|
192
|
-
)}
|
|
179
|
+
{renderFormItem(application, signupItem, state, setState, t)}
|
|
193
180
|
</div>
|
|
194
181
|
);
|
|
195
182
|
});
|
|
@@ -203,16 +190,12 @@ type SignUpProps = {
|
|
|
203
190
|
applicationName: string;
|
|
204
191
|
casdoorApiRoot: string;
|
|
205
192
|
springmicroApiRoot?: string;
|
|
206
|
-
CLIENT_ID: string;
|
|
207
|
-
CLIENT_SECRET: string;
|
|
208
193
|
};
|
|
209
194
|
|
|
210
195
|
export function SignUp({
|
|
211
196
|
applicationName,
|
|
212
197
|
casdoorApiRoot,
|
|
213
198
|
springmicroApiRoot,
|
|
214
|
-
CLIENT_ID,
|
|
215
|
-
CLIENT_SECRET,
|
|
216
199
|
}: SignUpProps) {
|
|
217
200
|
Setting.ROOT_URLS.casdoor = casdoorApiRoot;
|
|
218
201
|
if (springmicroApiRoot) {
|
|
@@ -221,22 +204,19 @@ export function SignUp({
|
|
|
221
204
|
const [state, setState] = React.useState<SignUpState>({ application: null });
|
|
222
205
|
|
|
223
206
|
const getApplication = () => {
|
|
224
|
-
ApplicationBackend.getApplication(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
if (res.status === "error") {
|
|
232
|
-
Setting.showMessage("error", res.msg);
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
207
|
+
ApplicationBackend.getApplication("admin", applicationName).then(
|
|
208
|
+
(res: any) => {
|
|
209
|
+
console.log(res);
|
|
210
|
+
if (res.status === "error") {
|
|
211
|
+
Setting.showMessage("error", res.msg);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
235
214
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
215
|
+
setState({
|
|
216
|
+
application: res.data,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
);
|
|
240
220
|
};
|
|
241
221
|
|
|
242
222
|
React.useEffect(() => {
|
|
@@ -254,8 +234,6 @@ export function SignUp({
|
|
|
254
234
|
application: application,
|
|
255
235
|
});
|
|
256
236
|
}}
|
|
257
|
-
CLIENT_ID={CLIENT_ID}
|
|
258
|
-
CLIENT_SECRET={CLIENT_SECRET}
|
|
259
237
|
/>
|
|
260
238
|
</I18nextProvider>
|
|
261
239
|
);
|
|
@@ -287,8 +265,6 @@ export function SignUpProvider({
|
|
|
287
265
|
applicationName,
|
|
288
266
|
casdoorApiRoot,
|
|
289
267
|
springmicroApiRoot,
|
|
290
|
-
CLIENT_ID,
|
|
291
|
-
CLIENT_SECRET,
|
|
292
268
|
children,
|
|
293
269
|
}: React.PropsWithChildren<SignUpProps>) {
|
|
294
270
|
const { t, i18n } = useTranslation();
|
|
@@ -303,22 +279,19 @@ export function SignUpProvider({
|
|
|
303
279
|
React.useState<Record<string, boolean>>({});
|
|
304
280
|
|
|
305
281
|
const getApplication = () => {
|
|
306
|
-
ApplicationBackend.getApplication(
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
if (res.status === "error") {
|
|
314
|
-
Setting.showMessage("error", res.msg);
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
282
|
+
ApplicationBackend.getApplication("admin", applicationName).then(
|
|
283
|
+
(res: any) => {
|
|
284
|
+
console.log(res);
|
|
285
|
+
if (res.status === "error") {
|
|
286
|
+
Setting.showMessage("error", res.msg);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
317
289
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
290
|
+
setState({
|
|
291
|
+
application: res.data,
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
);
|
|
322
295
|
};
|
|
323
296
|
|
|
324
297
|
const onUpdateApplication = (application: Application) => {
|
|
@@ -21,7 +21,7 @@ import { useTranslation } from "react-i18next";
|
|
|
21
21
|
|
|
22
22
|
type ButtonClickArgsTuple = [
|
|
23
23
|
dest: any,
|
|
24
|
-
type:
|
|
24
|
+
type: string,
|
|
25
25
|
applicationId: any,
|
|
26
26
|
checkUser?: string
|
|
27
27
|
];
|
|
@@ -35,8 +35,6 @@ export type SendCodeInputProps = {
|
|
|
35
35
|
application: Application;
|
|
36
36
|
method: string;
|
|
37
37
|
countryCode: string;
|
|
38
|
-
CLIENT_ID: string;
|
|
39
|
-
CLIENT_SECRET: string;
|
|
40
38
|
};
|
|
41
39
|
|
|
42
40
|
export const SendCodeInput = ({
|
|
@@ -48,8 +46,6 @@ export const SendCodeInput = ({
|
|
|
48
46
|
application,
|
|
49
47
|
method,
|
|
50
48
|
countryCode,
|
|
51
|
-
CLIENT_ID,
|
|
52
|
-
CLIENT_SECRET,
|
|
53
49
|
}: SendCodeInputProps) => {
|
|
54
50
|
const { t } = useTranslation();
|
|
55
51
|
const [visible, setVisible] = React.useState(false);
|
|
@@ -84,9 +80,7 @@ export const SendCodeInput = ({
|
|
|
84
80
|
clientSecret,
|
|
85
81
|
method,
|
|
86
82
|
countryCode,
|
|
87
|
-
...onButtonClickArgs
|
|
88
|
-
CLIENT_ID,
|
|
89
|
-
CLIENT_SECRET
|
|
83
|
+
...onButtonClickArgs
|
|
90
84
|
).then((res: any) => {
|
|
91
85
|
setButtonLoading(false);
|
|
92
86
|
if (res) {
|
|
@@ -157,9 +157,7 @@ export function renderFormItem(
|
|
|
157
157
|
signupItem: any,
|
|
158
158
|
state: SignUpFormState,
|
|
159
159
|
setState: React.Dispatch<React.SetStateAction<SignUpFormState>>,
|
|
160
|
-
t: TFunction<"translation", undefined
|
|
161
|
-
CLIENT_ID: string,
|
|
162
|
-
CLIENT_SECRET: string
|
|
160
|
+
t: TFunction<"translation", undefined>
|
|
163
161
|
) {
|
|
164
162
|
if (!signupItem.visible) {
|
|
165
163
|
return null;
|
|
@@ -355,8 +353,6 @@ export function renderFormItem(
|
|
|
355
353
|
onChange={(value: string) =>
|
|
356
354
|
setState({ ...state, emailCode: value })
|
|
357
355
|
}
|
|
358
|
-
CLIENT_ID={CLIENT_ID}
|
|
359
|
-
CLIENT_SECRET={CLIENT_SECRET}
|
|
360
356
|
/>
|
|
361
357
|
}
|
|
362
358
|
setFieldValue={setFieldValue}
|
|
@@ -59,21 +59,15 @@ export function getApplicationsByOrganization(
|
|
|
59
59
|
).then((res) => res.json());
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export function getApplication(
|
|
63
|
-
owner: string,
|
|
64
|
-
name: string,
|
|
65
|
-
CLIENT_ID: string,
|
|
66
|
-
CLIENT_SECRET: string
|
|
67
|
-
) {
|
|
68
|
-
console.log("ATTEMPTING TO GET APPLICATION");
|
|
62
|
+
export function getApplication(owner: string, name: string) {
|
|
69
63
|
return fetch(
|
|
70
64
|
`${
|
|
71
65
|
Setting.ROOT_URLS.casdoor
|
|
72
66
|
}/api/get-application?id=${owner}/${encodeURIComponent(name)}`,
|
|
73
67
|
{
|
|
74
68
|
method: "GET",
|
|
69
|
+
credentials: "include",
|
|
75
70
|
headers: {
|
|
76
|
-
Authorization: "Basic " + btoa(`${CLIENT_ID}:${CLIENT_SECRET}`),
|
|
77
71
|
"Content-Type": "application/json",
|
|
78
72
|
},
|
|
79
73
|
}
|
|
@@ -170,9 +170,7 @@ export function sendCode(
|
|
|
170
170
|
dest,
|
|
171
171
|
type,
|
|
172
172
|
applicationId,
|
|
173
|
-
checkUser = ""
|
|
174
|
-
CLIENT_ID,
|
|
175
|
-
CLIENT_SECRET
|
|
173
|
+
checkUser = ""
|
|
176
174
|
) {
|
|
177
175
|
const formData = new FormData();
|
|
178
176
|
formData.append("captchaType", captchaType);
|
|
@@ -184,14 +182,13 @@ export function sendCode(
|
|
|
184
182
|
formData.append("type", type);
|
|
185
183
|
formData.append("applicationId", "admin/" + applicationId);
|
|
186
184
|
formData.append("checkUser", checkUser);
|
|
187
|
-
|
|
185
|
+
|
|
188
186
|
return fetch(`${ROOT_URLS.casdoor}/api/send-verification-code`, {
|
|
189
187
|
method: "POST",
|
|
190
|
-
|
|
188
|
+
credentials: "include",
|
|
191
189
|
body: formData,
|
|
192
190
|
headers: {
|
|
193
|
-
|
|
194
|
-
"Content-Type": "application/json",
|
|
191
|
+
// "Content-Type": "application/json",
|
|
195
192
|
"Accept-Language": getAcceptLanguage(),
|
|
196
193
|
},
|
|
197
194
|
})
|