@springmicro/auth 0.1.9 → 0.2.0-alpha.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/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,493 @@
|
|
|
1
|
+
import type { Application, Provider } from "./provider";
|
|
2
|
+
import * as phoneNumber from "libphonenumber-js";
|
|
3
|
+
|
|
4
|
+
export const StaticBaseUrl = "https://cdn.casbin.org";
|
|
5
|
+
export const ROOT_URLS: { casdoor: string; springmicro: string | undefined } = {
|
|
6
|
+
casdoor: "https://casdoor",
|
|
7
|
+
springmicro: undefined,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function getLanguage() {
|
|
11
|
+
return "en";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function getAcceptLanguage() {
|
|
15
|
+
// https://github.com/casdoor/casdoor/blob/739cfd84ed232159226f514c4a0b5168a995eeb0/web/src/Setting.js#L891
|
|
16
|
+
return "en;q=0.9,en;q=0.8";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function deepCopy(obj: any) {
|
|
20
|
+
// https://github.com/casdoor/casdoor/blob/739cfd84ed232159226f514c4a0b5168a995eeb0/web/src/Setting.js#L755
|
|
21
|
+
return Object.assign({}, obj);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function showMessage(obj: string, text: string) {
|
|
25
|
+
// https://github.com/casdoor/casdoor/blob/739cfd84ed232159226f514c4a0b5168a995eeb0/web/src/Setting.js#L731
|
|
26
|
+
// message is the antd toast api
|
|
27
|
+
// if (type === "success") {
|
|
28
|
+
// message.success(text);
|
|
29
|
+
// } else if (type === "error") {
|
|
30
|
+
// message.error(text);
|
|
31
|
+
// } else if (type === "info") {
|
|
32
|
+
// message.info(text);
|
|
33
|
+
// }
|
|
34
|
+
// temporary workaround
|
|
35
|
+
alert(text);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function goToLink(link?: string) {
|
|
39
|
+
if (link === undefined) return;
|
|
40
|
+
window.location.href = link;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type ProviderItem = { provider?: Provider | null; prompted: boolean };
|
|
44
|
+
|
|
45
|
+
export function isProviderVisible(providerItem: ProviderItem) {
|
|
46
|
+
if (providerItem.provider === undefined || providerItem.provider === null) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (!["OAuth", "SAML", "Web3"].includes(providerItem.provider.category)) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (providerItem.provider.type === "WeChatMiniProgram") {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function isProviderPrompted(providerItem: ProviderItem) {
|
|
62
|
+
return isProviderVisible(providerItem) && providerItem.prompted;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
type SignupItem = {
|
|
66
|
+
visible: boolean;
|
|
67
|
+
prompted: boolean;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export function isSignupItemPrompted(signupItem: SignupItem) {
|
|
71
|
+
return signupItem.visible && signupItem.prompted;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function getAllPromptedProviderItems(application: Application) {
|
|
75
|
+
return application.providers?.filter((providerItem) =>
|
|
76
|
+
isProviderPrompted(providerItem)
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function getAllPromptedSignupItems(application: Application) {
|
|
81
|
+
return application.signupItems?.filter((signupItem) =>
|
|
82
|
+
isSignupItemPrompted(signupItem)
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function getSignupItem(application: Application, itemName: string) {
|
|
87
|
+
const signupItems = application.signupItems?.filter(
|
|
88
|
+
(signupItem) => signupItem.name === itemName
|
|
89
|
+
);
|
|
90
|
+
if (signupItems?.length ?? 0 > 0) {
|
|
91
|
+
return signupItems![0];
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function isAffiliationPrompted(application: Application) {
|
|
97
|
+
const signupItem = getSignupItem(application, "Affiliation");
|
|
98
|
+
if (signupItem === null) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return signupItem.prompted;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function isValidIdCard(idCard: string) {
|
|
106
|
+
return idCard !== "";
|
|
107
|
+
|
|
108
|
+
// const idCardRegex = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9X]$/;
|
|
109
|
+
// return idCardRegex.test(idCard);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function isValidEmail(email: string) {
|
|
113
|
+
// https://github.com/yiminghe/async-validator/blob/057b0b047f88fac65457bae691d6cb7c6fe48ce1/src/rule/type.ts#L9
|
|
114
|
+
const emailRegex =
|
|
115
|
+
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
116
|
+
return emailRegex.test(email);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function isValidPhone(phone: string, countryCode = "") {
|
|
120
|
+
if (countryCode !== "" && countryCode !== "CN") {
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
return phoneNumber.isValidPhoneNumber(phone, countryCode);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// https://learnku.com/articles/31543, `^s*$` filter empty email individually.
|
|
126
|
+
const phoneCnRegex =
|
|
127
|
+
/^1(3\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\d|9[0-35-9])\d{8}$/;
|
|
128
|
+
const phoneRegex = /[0-9]{4,15}$/;
|
|
129
|
+
|
|
130
|
+
return countryCode === "CN"
|
|
131
|
+
? phoneCnRegex.test(phone)
|
|
132
|
+
: phoneRegex.test(phone);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function isSigninMethodEnabled(
|
|
136
|
+
application: Application | null,
|
|
137
|
+
signinMethod: string
|
|
138
|
+
) {
|
|
139
|
+
if (application && application.signinMethods) {
|
|
140
|
+
return (
|
|
141
|
+
application.signinMethods.filter((item) => item.name === signinMethod)
|
|
142
|
+
.length > 0
|
|
143
|
+
);
|
|
144
|
+
} else {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function isPasswordEnabled(application: Application | null) {
|
|
150
|
+
return isSigninMethodEnabled(application, "Password");
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function isCodeSigninEnabled(application: Application | null) {
|
|
154
|
+
return isSigninMethodEnabled(application, "Verification code");
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function isWebAuthnEnabled(application: Application | null) {
|
|
158
|
+
return isSigninMethodEnabled(application, "WebAuthn");
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function isLdapEnabled(application: Application | null) {
|
|
162
|
+
return isSigninMethodEnabled(application, "LDAP");
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function isFaceIdEnabled(application: Application | null) {
|
|
166
|
+
return isSigninMethodEnabled(application, "Face ID");
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function hasPromptPage(application: Application) {
|
|
170
|
+
const providerItems = getAllPromptedProviderItems(application);
|
|
171
|
+
if (providerItems?.length ?? 0 > 0) {
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const signupItems = getAllPromptedSignupItems(application);
|
|
176
|
+
if (signupItems?.length ?? 0 > 0) {
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return isAffiliationPrompted(application);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function getProviderLogoURL(provider: Provider) {
|
|
184
|
+
if (provider.type === "Custom" && provider.customLogo) {
|
|
185
|
+
return provider.customLogo;
|
|
186
|
+
}
|
|
187
|
+
if (provider.category === "OAuth") {
|
|
188
|
+
return `${StaticBaseUrl}/img/social_${provider.type.toLowerCase()}.png`;
|
|
189
|
+
} else {
|
|
190
|
+
const info: { logo: string; url: string } =
|
|
191
|
+
OtherProviderInfo[provider.category as OPIKey][
|
|
192
|
+
provider.type as OPITypeKey
|
|
193
|
+
];
|
|
194
|
+
// avoid crash when provider is not found
|
|
195
|
+
if (info) {
|
|
196
|
+
return info.logo;
|
|
197
|
+
}
|
|
198
|
+
return "";
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export type OPIKey = keyof typeof OtherProviderInfo;
|
|
203
|
+
|
|
204
|
+
export type OPITypeKey = keyof (typeof OtherProviderInfo)[OPIKey];
|
|
205
|
+
|
|
206
|
+
export const OtherProviderInfo = {
|
|
207
|
+
SMS: {
|
|
208
|
+
"Aliyun SMS": {
|
|
209
|
+
logo: `${StaticBaseUrl}/img/social_aliyun.png`,
|
|
210
|
+
url: "https://aliyun.com/product/sms",
|
|
211
|
+
},
|
|
212
|
+
"Amazon SNS": {
|
|
213
|
+
logo: `${StaticBaseUrl}/img/social_aws.png`,
|
|
214
|
+
url: "https://aws.amazon.com/cn/sns/",
|
|
215
|
+
},
|
|
216
|
+
"Azure ACS": {
|
|
217
|
+
logo: `${StaticBaseUrl}/img/social_azure.png`,
|
|
218
|
+
url: "https://azure.microsoft.com/en-us/products/communication-services",
|
|
219
|
+
},
|
|
220
|
+
"Infobip SMS": {
|
|
221
|
+
logo: `${StaticBaseUrl}/img/social_infobip.png`,
|
|
222
|
+
url: "https://portal.infobip.com/homepage/",
|
|
223
|
+
},
|
|
224
|
+
"Tencent Cloud SMS": {
|
|
225
|
+
logo: `${StaticBaseUrl}/img/social_tencent_cloud.jpg`,
|
|
226
|
+
url: "https://cloud.tencent.com/product/sms",
|
|
227
|
+
},
|
|
228
|
+
"Baidu Cloud SMS": {
|
|
229
|
+
logo: `${StaticBaseUrl}/img/social_baidu_cloud.png`,
|
|
230
|
+
url: "https://cloud.baidu.com/product/sms.html",
|
|
231
|
+
},
|
|
232
|
+
"Volc Engine SMS": {
|
|
233
|
+
logo: `${StaticBaseUrl}/img/social_volc_engine.jpg`,
|
|
234
|
+
url: "https://www.volcengine.com/products/cloud-sms",
|
|
235
|
+
},
|
|
236
|
+
"Huawei Cloud SMS": {
|
|
237
|
+
logo: `${StaticBaseUrl}/img/social_huawei.png`,
|
|
238
|
+
url: "https://www.huaweicloud.com/product/msgsms.html",
|
|
239
|
+
},
|
|
240
|
+
"UCloud SMS": {
|
|
241
|
+
logo: `${StaticBaseUrl}/img/social_ucloud.png`,
|
|
242
|
+
url: "https://www.ucloud.cn/site/product/usms.html",
|
|
243
|
+
},
|
|
244
|
+
"Twilio SMS": {
|
|
245
|
+
logo: `${StaticBaseUrl}/img/social_twilio.svg`,
|
|
246
|
+
url: "https://www.twilio.com/messaging",
|
|
247
|
+
},
|
|
248
|
+
"SmsBao SMS": {
|
|
249
|
+
logo: `${StaticBaseUrl}/img/social_smsbao.png`,
|
|
250
|
+
url: "https://www.smsbao.com/",
|
|
251
|
+
},
|
|
252
|
+
"SUBMAIL SMS": {
|
|
253
|
+
logo: `${StaticBaseUrl}/img/social_submail.svg`,
|
|
254
|
+
url: "https://www.mysubmail.com",
|
|
255
|
+
},
|
|
256
|
+
"Msg91 SMS": {
|
|
257
|
+
logo: `${StaticBaseUrl}/img/social_msg91.ico`,
|
|
258
|
+
url: "https://control.msg91.com/app/",
|
|
259
|
+
},
|
|
260
|
+
"OSON SMS": {
|
|
261
|
+
logo: "https://osonsms.com/images/osonsms-logo.svg",
|
|
262
|
+
url: "https://osonsms.com/",
|
|
263
|
+
},
|
|
264
|
+
"Custom HTTP SMS": {
|
|
265
|
+
logo: `${StaticBaseUrl}/img/social_default.png`,
|
|
266
|
+
url: "https://casdoor.org/docs/provider/sms/overview",
|
|
267
|
+
},
|
|
268
|
+
"Mock SMS": {
|
|
269
|
+
logo: `${StaticBaseUrl}/img/social_default.png`,
|
|
270
|
+
url: "",
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
Email: {
|
|
274
|
+
Default: {
|
|
275
|
+
logo: `${StaticBaseUrl}/img/email_default.png`,
|
|
276
|
+
url: "",
|
|
277
|
+
},
|
|
278
|
+
SUBMAIL: {
|
|
279
|
+
logo: `${StaticBaseUrl}/img/social_submail.svg`,
|
|
280
|
+
url: "https://www.mysubmail.com",
|
|
281
|
+
},
|
|
282
|
+
Mailtrap: {
|
|
283
|
+
logo: `${StaticBaseUrl}/img/email_mailtrap.png`,
|
|
284
|
+
url: "https://mailtrap.io",
|
|
285
|
+
},
|
|
286
|
+
"Azure ACS": {
|
|
287
|
+
logo: `${StaticBaseUrl}/img/social_azure.png`,
|
|
288
|
+
url: "https://learn.microsoft.com/zh-cn/azure/communication-services",
|
|
289
|
+
},
|
|
290
|
+
SendGrid: {
|
|
291
|
+
logo: `${StaticBaseUrl}/img/email_sendgrid.png`,
|
|
292
|
+
url: "https://sendgrid.com/",
|
|
293
|
+
},
|
|
294
|
+
"Custom HTTP Email": {
|
|
295
|
+
logo: `${StaticBaseUrl}/img/social_default.png`,
|
|
296
|
+
url: "https://casdoor.org/docs/provider/email/overview",
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
Storage: {
|
|
300
|
+
"Local File System": {
|
|
301
|
+
logo: `${StaticBaseUrl}/img/social_file.png`,
|
|
302
|
+
url: "",
|
|
303
|
+
},
|
|
304
|
+
"AWS S3": {
|
|
305
|
+
logo: `${StaticBaseUrl}/img/social_aws.png`,
|
|
306
|
+
url: "https://aws.amazon.com/s3",
|
|
307
|
+
},
|
|
308
|
+
MinIO: {
|
|
309
|
+
logo: "https://min.io/resources/img/logo.svg",
|
|
310
|
+
url: "https://min.io/",
|
|
311
|
+
},
|
|
312
|
+
"Aliyun OSS": {
|
|
313
|
+
logo: `${StaticBaseUrl}/img/social_aliyun.png`,
|
|
314
|
+
url: "https://aliyun.com/product/oss",
|
|
315
|
+
},
|
|
316
|
+
"Tencent Cloud COS": {
|
|
317
|
+
logo: `${StaticBaseUrl}/img/social_tencent_cloud.jpg`,
|
|
318
|
+
url: "https://cloud.tencent.com/product/cos",
|
|
319
|
+
},
|
|
320
|
+
"Azure Blob": {
|
|
321
|
+
logo: `${StaticBaseUrl}/img/social_azure.png`,
|
|
322
|
+
url: "https://azure.microsoft.com/en-us/services/storage/blobs/",
|
|
323
|
+
},
|
|
324
|
+
"Qiniu Cloud Kodo": {
|
|
325
|
+
logo: `${StaticBaseUrl}/img/social_qiniu_cloud.png`,
|
|
326
|
+
url: "https://www.qiniu.com/solutions/storage",
|
|
327
|
+
},
|
|
328
|
+
"Google Cloud Storage": {
|
|
329
|
+
logo: `${StaticBaseUrl}/img/social_google_cloud.png`,
|
|
330
|
+
url: "https://cloud.google.com/storage",
|
|
331
|
+
},
|
|
332
|
+
Synology: {
|
|
333
|
+
logo: `${StaticBaseUrl}/img/social_synology.png`,
|
|
334
|
+
url: "https://www.synology.com/en-global/dsm/feature/file_sharing",
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
SAML: {
|
|
338
|
+
"Aliyun IDaaS": {
|
|
339
|
+
logo: `${StaticBaseUrl}/img/social_aliyun.png`,
|
|
340
|
+
url: "https://aliyun.com/product/idaas",
|
|
341
|
+
},
|
|
342
|
+
Keycloak: {
|
|
343
|
+
logo: `${StaticBaseUrl}/img/social_keycloak.png`,
|
|
344
|
+
url: "https://www.keycloak.org/",
|
|
345
|
+
},
|
|
346
|
+
Custom: {
|
|
347
|
+
logo: `${StaticBaseUrl}/img/social_custom.png`,
|
|
348
|
+
url: "https://door.casdoor.com/",
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
Payment: {
|
|
352
|
+
Dummy: {
|
|
353
|
+
logo: `${StaticBaseUrl}/img/payment_paypal.png`,
|
|
354
|
+
url: "",
|
|
355
|
+
},
|
|
356
|
+
Alipay: {
|
|
357
|
+
logo: `${StaticBaseUrl}/img/payment_alipay.png`,
|
|
358
|
+
url: "https://www.alipay.com/",
|
|
359
|
+
},
|
|
360
|
+
"WeChat Pay": {
|
|
361
|
+
logo: `${StaticBaseUrl}/img/payment_wechat_pay.png`,
|
|
362
|
+
url: "https://pay.weixin.qq.com/",
|
|
363
|
+
},
|
|
364
|
+
PayPal: {
|
|
365
|
+
logo: `${StaticBaseUrl}/img/payment_paypal.png`,
|
|
366
|
+
url: "https://www.paypal.com/",
|
|
367
|
+
},
|
|
368
|
+
Stripe: {
|
|
369
|
+
logo: `${StaticBaseUrl}/img/social_stripe.png`,
|
|
370
|
+
url: "https://stripe.com/",
|
|
371
|
+
},
|
|
372
|
+
GC: {
|
|
373
|
+
logo: `${StaticBaseUrl}/img/payment_gc.png`,
|
|
374
|
+
url: "https://gc.org",
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
Captcha: {
|
|
378
|
+
Default: {
|
|
379
|
+
logo: `${StaticBaseUrl}/img/captcha_default.png`,
|
|
380
|
+
url: "https://pkg.go.dev/github.com/dchest/captcha",
|
|
381
|
+
},
|
|
382
|
+
reCAPTCHA: {
|
|
383
|
+
logo: `${StaticBaseUrl}/img/social_recaptcha.png`,
|
|
384
|
+
url: "https://www.google.com/recaptcha",
|
|
385
|
+
},
|
|
386
|
+
hCaptcha: {
|
|
387
|
+
logo: `${StaticBaseUrl}/img/social_hcaptcha.png`,
|
|
388
|
+
url: "https://www.hcaptcha.com",
|
|
389
|
+
},
|
|
390
|
+
"Aliyun Captcha": {
|
|
391
|
+
logo: `${StaticBaseUrl}/img/social_aliyun.png`,
|
|
392
|
+
url: "https://help.aliyun.com/product/28308.html",
|
|
393
|
+
},
|
|
394
|
+
GEETEST: {
|
|
395
|
+
logo: `${StaticBaseUrl}/img/social_geetest.png`,
|
|
396
|
+
url: "https://www.geetest.com",
|
|
397
|
+
},
|
|
398
|
+
"Cloudflare Turnstile": {
|
|
399
|
+
logo: `${StaticBaseUrl}/img/social_cloudflare.png`,
|
|
400
|
+
url: "https://www.cloudflare.com/products/turnstile/",
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
AI: {
|
|
404
|
+
"OpenAI API - GPT": {
|
|
405
|
+
logo: `${StaticBaseUrl}/img/social_openai.svg`,
|
|
406
|
+
url: "https://platform.openai.com",
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
Web3: {
|
|
410
|
+
MetaMask: {
|
|
411
|
+
logo: `${StaticBaseUrl}/img/social_metamask.svg`,
|
|
412
|
+
url: "https://metamask.io/",
|
|
413
|
+
},
|
|
414
|
+
Web3Onboard: {
|
|
415
|
+
logo: `${StaticBaseUrl}/img/social_web3onboard.svg`,
|
|
416
|
+
url: "https://onboard.blocknative.com/",
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
Notification: {
|
|
420
|
+
Telegram: {
|
|
421
|
+
logo: `${StaticBaseUrl}/img/social_telegram.png`,
|
|
422
|
+
url: "https://telegram.org/",
|
|
423
|
+
},
|
|
424
|
+
"Custom HTTP": {
|
|
425
|
+
logo: `${StaticBaseUrl}/img/email_default.png`,
|
|
426
|
+
url: "https://casdoor.org/docs/provider/notification/overview",
|
|
427
|
+
},
|
|
428
|
+
DingTalk: {
|
|
429
|
+
logo: `${StaticBaseUrl}/img/social_dingtalk.png`,
|
|
430
|
+
url: "https://www.dingtalk.com/",
|
|
431
|
+
},
|
|
432
|
+
Lark: {
|
|
433
|
+
logo: `${StaticBaseUrl}/img/social_lark.png`,
|
|
434
|
+
url: "https://www.larksuite.com/",
|
|
435
|
+
},
|
|
436
|
+
"Microsoft Teams": {
|
|
437
|
+
logo: `${StaticBaseUrl}/img/social_teams.png`,
|
|
438
|
+
url: "https://www.microsoft.com/microsoft-teams",
|
|
439
|
+
},
|
|
440
|
+
Bark: {
|
|
441
|
+
logo: `${StaticBaseUrl}/img/social_bark.png`,
|
|
442
|
+
url: "https://apps.apple.com/us/app/bark-customed-notifications/id1403753865",
|
|
443
|
+
},
|
|
444
|
+
Pushover: {
|
|
445
|
+
logo: `${StaticBaseUrl}/img/social_pushover.png`,
|
|
446
|
+
url: "https://pushover.net/",
|
|
447
|
+
},
|
|
448
|
+
Pushbullet: {
|
|
449
|
+
logo: `${StaticBaseUrl}/img/social_pushbullet.png`,
|
|
450
|
+
url: "https://www.pushbullet.com/",
|
|
451
|
+
},
|
|
452
|
+
Slack: {
|
|
453
|
+
logo: `${StaticBaseUrl}/img/social_slack.png`,
|
|
454
|
+
url: "https://slack.com/",
|
|
455
|
+
},
|
|
456
|
+
Webpush: {
|
|
457
|
+
logo: `${StaticBaseUrl}/img/email_default.png`,
|
|
458
|
+
url: "https://developer.mozilla.org/en-US/docs/Web/API/Push_API",
|
|
459
|
+
},
|
|
460
|
+
Discord: {
|
|
461
|
+
logo: `${StaticBaseUrl}/img/social_discord.png`,
|
|
462
|
+
url: "https://discord.com/",
|
|
463
|
+
},
|
|
464
|
+
"Google Chat": {
|
|
465
|
+
logo: `${StaticBaseUrl}/img/social_google_chat.png`,
|
|
466
|
+
url: "https://workspace.google.com/intl/en/products/chat/",
|
|
467
|
+
},
|
|
468
|
+
Line: {
|
|
469
|
+
logo: `${StaticBaseUrl}/img/social_line.png`,
|
|
470
|
+
url: "https://line.me/",
|
|
471
|
+
},
|
|
472
|
+
Matrix: {
|
|
473
|
+
logo: `${StaticBaseUrl}/img/social_matrix.png`,
|
|
474
|
+
url: "https://www.matrix.org/",
|
|
475
|
+
},
|
|
476
|
+
Twitter: {
|
|
477
|
+
logo: `${StaticBaseUrl}/img/social_twitter.png`,
|
|
478
|
+
url: "https://twitter.com/",
|
|
479
|
+
},
|
|
480
|
+
Reddit: {
|
|
481
|
+
logo: `${StaticBaseUrl}/img/social_reddit.png`,
|
|
482
|
+
url: "https://www.reddit.com/",
|
|
483
|
+
},
|
|
484
|
+
"Rocket Chat": {
|
|
485
|
+
logo: `${StaticBaseUrl}/img/social_rocket_chat.png`,
|
|
486
|
+
url: "https://rocket.chat/",
|
|
487
|
+
},
|
|
488
|
+
Viber: {
|
|
489
|
+
logo: `${StaticBaseUrl}/img/social_viber.png`,
|
|
490
|
+
url: "https://www.viber.com/",
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// https://github.com/casdoor/casdoor/blob/master/web/src/backend/InvitationBackend.js
|
|
2
|
+
|
|
3
|
+
// Copyright 2023 The Casdoor Authors. All Rights Reserved.
|
|
4
|
+
//
|
|
5
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
// you may not use this file except in compliance with the License.
|
|
7
|
+
// You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
// See the License for the specific language governing permissions and
|
|
15
|
+
// limitations under the License.
|
|
16
|
+
|
|
17
|
+
import * as Setting from "./core";
|
|
18
|
+
|
|
19
|
+
export type Invitation = any;
|
|
20
|
+
|
|
21
|
+
export function getInvitations(
|
|
22
|
+
owner: string,
|
|
23
|
+
page = "",
|
|
24
|
+
pageSize = "",
|
|
25
|
+
field = "",
|
|
26
|
+
value = "",
|
|
27
|
+
sortField = "",
|
|
28
|
+
sortOrder = ""
|
|
29
|
+
) {
|
|
30
|
+
return fetch(
|
|
31
|
+
`${Setting.ROOT_URLS.casdoor}/api/get-invitations?owner=${owner}&p=${page}&pageSize=${pageSize}&field=${field}&value=${value}&sortField=${sortField}&sortOrder=${sortOrder}`,
|
|
32
|
+
{
|
|
33
|
+
method: "GET",
|
|
34
|
+
credentials: "include",
|
|
35
|
+
headers: {
|
|
36
|
+
"Accept-Language": Setting.getAcceptLanguage(),
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
).then((res) => res.json());
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function getInvitation(owner: string, name: string) {
|
|
43
|
+
return fetch(
|
|
44
|
+
`${Setting.ROOT_URLS.casdoor}/api/get-invitation?id=${owner}/${encodeURIComponent(
|
|
45
|
+
name
|
|
46
|
+
)}`,
|
|
47
|
+
{
|
|
48
|
+
method: "GET",
|
|
49
|
+
credentials: "include",
|
|
50
|
+
headers: {
|
|
51
|
+
"Accept-Language": Setting.getAcceptLanguage(),
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
).then((res) => res.json());
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function getInvitationCodeInfo(code: string, applicationName: string) {
|
|
58
|
+
return fetch(
|
|
59
|
+
`${
|
|
60
|
+
Setting.ROOT_URLS.casdoor
|
|
61
|
+
}/api/get-invitation-info?code=${code}&applicationId=${encodeURIComponent(
|
|
62
|
+
applicationName
|
|
63
|
+
)}`,
|
|
64
|
+
{
|
|
65
|
+
method: "GET",
|
|
66
|
+
credentials: "include",
|
|
67
|
+
headers: {
|
|
68
|
+
"Accept-Language": Setting.getAcceptLanguage(),
|
|
69
|
+
},
|
|
70
|
+
}
|
|
71
|
+
).then((res) => res.json());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function updateInvitation(
|
|
75
|
+
owner: string,
|
|
76
|
+
name: string,
|
|
77
|
+
invitation: Invitation
|
|
78
|
+
) {
|
|
79
|
+
const newInvitation = Setting.deepCopy(invitation);
|
|
80
|
+
return fetch(
|
|
81
|
+
`${
|
|
82
|
+
Setting.ROOT_URLS.casdoor
|
|
83
|
+
}/api/update-invitation?id=${owner}/${encodeURIComponent(name)}`,
|
|
84
|
+
{
|
|
85
|
+
method: "POST",
|
|
86
|
+
credentials: "include",
|
|
87
|
+
body: JSON.stringify(newInvitation),
|
|
88
|
+
headers: {
|
|
89
|
+
"Accept-Language": Setting.getAcceptLanguage(),
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
).then((res) => res.json());
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function addInvitation(invitation: Invitation) {
|
|
96
|
+
const newInvitation = Setting.deepCopy(invitation);
|
|
97
|
+
return fetch(`${Setting.ROOT_URLS.casdoor}/api/add-invitation`, {
|
|
98
|
+
method: "POST",
|
|
99
|
+
credentials: "include",
|
|
100
|
+
body: JSON.stringify(newInvitation),
|
|
101
|
+
headers: {
|
|
102
|
+
"Accept-Language": Setting.getAcceptLanguage(),
|
|
103
|
+
},
|
|
104
|
+
}).then((res) => res.json());
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function deleteInvitation(invitation: Invitation) {
|
|
108
|
+
const newInvitation = Setting.deepCopy(invitation);
|
|
109
|
+
return fetch(`${Setting.ROOT_URLS.casdoor}/api/delete-invitation`, {
|
|
110
|
+
method: "POST",
|
|
111
|
+
credentials: "include",
|
|
112
|
+
body: JSON.stringify(newInvitation),
|
|
113
|
+
headers: {
|
|
114
|
+
"Accept-Language": Setting.getAcceptLanguage(),
|
|
115
|
+
},
|
|
116
|
+
}).then((res) => res.json());
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function verifyInvitation(owner: string, name: string) {
|
|
120
|
+
return fetch(
|
|
121
|
+
`${
|
|
122
|
+
Setting.ROOT_URLS.casdoor
|
|
123
|
+
}/api/verify-invitation?id=${owner}/${encodeURIComponent(name)}`,
|
|
124
|
+
{
|
|
125
|
+
method: "GET",
|
|
126
|
+
credentials: "include",
|
|
127
|
+
headers: {
|
|
128
|
+
"Accept-Language": Setting.getAcceptLanguage(),
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
).then((res) => res.json());
|
|
132
|
+
}
|