@springmicro/auth 0.1.9 → 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.
Files changed (135) hide show
  1. package/dist/Index-652aeb8c-BTQ1rBi7.js +2818 -0
  2. package/dist/Index-c419311f-BOZhAAW3.js +1054 -0
  3. package/dist/Web3Auth-hACKSouN.js +32769 -0
  4. package/dist/alphawallet-B7eovdf-.js +26 -0
  5. package/dist/apexwallet-ysP20G9D.js +93 -0
  6. package/dist/atoken-BBnNTzcz.js +27 -0
  7. package/dist/bifrostwallet-CNNBO92h.js +11 -0
  8. package/dist/binance-DvPgAzCw.js +14 -0
  9. package/dist/bitget-DZOUrwgy.js +4 -0
  10. package/dist/bitpie-C_uxmEzw.js +25 -0
  11. package/dist/bitski-DpzkHNkv.js +4 -0
  12. package/dist/blockwallet-BL69cqkA.js +8 -0
  13. package/dist/brave-DnRzMQYW.js +35 -0
  14. package/dist/ccip-c78d2f16-DLcRlwod.js +165 -0
  15. package/dist/coin98wallet-CkFdOvXt.js +4 -0
  16. package/dist/coinbase-CaGNx5if.js +9 -0
  17. package/dist/core-9rK8tWud.js +7 -0
  18. package/dist/defiwallet-0AsgJBSy.js +10 -0
  19. package/dist/detected-CX_JZaUk.js +6 -0
  20. package/dist/echooo-CmaetT_Z.js +14 -0
  21. package/dist/enkrypt-BibtwvK7.js +20 -0
  22. package/dist/exodus-BxzkDWWP.js +4 -0
  23. package/dist/fordefi-CvKyVwhI.js +6 -0
  24. package/dist/foxwallet-D7c_LDTf.js +4 -0
  25. package/dist/frame-CDfNmjUy.js +7 -0
  26. package/dist/frontier-DqKNSj2z.js +8 -0
  27. package/dist/huobiwallet-CxSwqa5L.js +14 -0
  28. package/dist/hyperpay-nmHE3WqM.js +7 -0
  29. package/dist/icon-2Zqy7pqQ.js +8 -0
  30. package/dist/icon-CGWI1Ies.js +43 -0
  31. package/dist/icon-C_O4nprO.js +9 -0
  32. package/dist/icon-DbgmZCnU.js +9 -0
  33. package/dist/icon-cAd7RhSC.js +9 -0
  34. package/dist/icon-duCa3gfT.js +11 -0
  35. package/dist/imtoken-yENtOTS3.js +17 -0
  36. package/dist/index-021f6a62-Zz543EDB.js +2583 -0
  37. package/dist/index-40a497ea-Bn2mC0r7.js +1010 -0
  38. package/dist/index-BHkXn9Ss.js +4010 -0
  39. package/dist/index-BaYEABY7.js +7089 -0
  40. package/dist/index-BtLU53lm.js +6023 -0
  41. package/dist/index-CynP9H3X.js +6188 -0
  42. package/dist/index-Dg8m-Szw.js +31 -0
  43. package/dist/index-Dt6M8ha9.js +161 -0
  44. package/dist/index-DtJfAdfq.js +5822 -0
  45. package/dist/index-klU8YB0c.js +1983 -0
  46. package/dist/index.d.ts +124 -0
  47. package/dist/index.js +5 -43
  48. package/dist/index.umd.cjs +1937 -1
  49. package/dist/infinitywallet-C8J4FUYw.js +42 -0
  50. package/dist/kayros-AIrUK1za.js +27 -0
  51. package/dist/lif3wallet-C5D6r8pg.js +41 -0
  52. package/dist/liquality-nbCtErVq.js +16 -0
  53. package/dist/mathwallet-CWkivCXo.js +50 -0
  54. package/dist/meetone-kKmvI8md.js +13 -0
  55. package/dist/metamask-BN7yiDV1.js +64 -0
  56. package/dist/mykey-CQZ6UcLH.js +13 -0
  57. package/dist/number-BXHWhlom.js +1529 -0
  58. package/dist/okxwallet-CJLVogh2.js +8 -0
  59. package/dist/oneInch-CciyZ4Pz.js +72 -0
  60. package/dist/onekey-Dal8kYjU.js +9 -0
  61. package/dist/opera-DnKg-TJU.js +24 -0
  62. package/dist/ownbit-BshJUVuW.js +18 -0
  63. package/dist/phantom-CJ8dIcov.js +35 -0
  64. package/dist/rabby-D4thTcd6.js +27 -0
  65. package/dist/rainbow-mXld6yWV.js +69 -0
  66. package/dist/roninwallet-ZyYrd-D1.js +9 -0
  67. package/dist/safeheron-Eg1Jb29V.js +23 -0
  68. package/dist/safepal-DVIKy94N.js +105 -0
  69. package/dist/sequence-BS2IbtDg.js +70 -0
  70. package/dist/stablewallet-jyB079Wb.js +20 -0
  71. package/dist/status-FrAvQjfn.js +4 -0
  72. package/dist/subwallet-DMvFqKyY.js +25 -0
  73. package/dist/talisman-Bp8zUXqB.js +16 -0
  74. package/dist/tallywallet-B4OS9nIr.js +16 -0
  75. package/dist/tokenary-C7jjcbQa.js +18 -0
  76. package/dist/tokenpocket-9ZRPmAFA.js +28 -0
  77. package/dist/tp-V2em5bdl.js +13 -0
  78. package/dist/transactionRequest-be6a8ea9-CUKWo5mx.js +1117 -0
  79. package/dist/trust-gPypS1O7.js +11 -0
  80. package/dist/xdefi-COVIyGz4.js +38 -0
  81. package/dist/zeal-DxHbDqm0.js +9 -0
  82. package/dist/zerion-BfW0UElc.js +8 -0
  83. package/dist/zodiacpilot-CrId6F4w.js +6 -0
  84. package/package.json +35 -15
  85. package/src/auth/config.ts +0 -2
  86. package/src/components/SignUp.tsx +442 -0
  87. package/src/components/forms/AgreementModal.tsx +88 -0
  88. package/src/components/forms/CaptchaController.tsx +94 -0
  89. package/src/components/forms/CaptchaModal.jsx +171 -0
  90. package/src/components/forms/CaptchaWidget.jsx +146 -0
  91. package/src/components/forms/PasswordChecker.ts +88 -0
  92. package/src/components/forms/SendCodeInput.tsx +149 -0
  93. package/src/components/forms/SignUpFormItem.tsx +704 -0
  94. package/src/components/forms/util/application-api.ts +155 -0
  95. package/src/components/forms/util/auth-api.ts +198 -0
  96. package/src/components/forms/util/auth-util.tsx +346 -0
  97. package/src/components/forms/util/core.ts +493 -0
  98. package/src/components/forms/util/invitation-api.ts +132 -0
  99. package/src/components/forms/util/provider.tsx +603 -0
  100. package/src/components/forms/util/user-api.ts +303 -0
  101. package/src/components/provider/AdfsLoginButton.jsx +38 -0
  102. package/src/components/provider/AlipayLoginButton.jsx +38 -0
  103. package/src/components/provider/AppleLoginButton.jsx +38 -0
  104. package/src/components/provider/AzureADB2CLoginButton.jsx +38 -0
  105. package/src/components/provider/AzureADLoginButton.jsx +38 -0
  106. package/src/components/provider/BaiduLoginButton.jsx +38 -0
  107. package/src/components/provider/BilibiliLoginButton.jsx +37 -0
  108. package/src/components/provider/CasdoorLoginButton.jsx +38 -0
  109. package/src/components/provider/DingTalkLoginButton.jsx +37 -0
  110. package/src/components/provider/DouyinLoginButton.jsx +38 -0
  111. package/src/components/provider/FacebookLoginButton.jsx +37 -0
  112. package/src/components/provider/GitHubLoginButton.jsx +37 -0
  113. package/src/components/provider/GitLabLoginButton.jsx +38 -0
  114. package/src/components/provider/GiteeLoginButton.jsx +34 -0
  115. package/src/components/provider/GoogleLoginButton.jsx +68 -0
  116. package/src/components/provider/InfoflowLoginButton.jsx +38 -0
  117. package/src/components/provider/LarkLoginButton.jsx +38 -0
  118. package/src/components/provider/LinkedInLoginButton.jsx +37 -0
  119. package/src/components/provider/LoginButton.jsx +33 -0
  120. package/src/components/provider/OktaLoginButton.jsx +38 -0
  121. package/src/components/provider/Provider.jsx +3 -0
  122. package/src/components/provider/ProviderButton.jsx +327 -0
  123. package/src/components/provider/QqLoginButton.jsx +31 -0
  124. package/src/components/provider/SelfLoginButton.jsx +47 -0
  125. package/src/components/provider/SlackLoginButton.jsx +38 -0
  126. package/src/components/provider/SteamLoginButton.jsx +38 -0
  127. package/src/components/provider/WeComLoginButton.jsx +34 -0
  128. package/src/components/provider/Web3Auth.jsx +365 -0
  129. package/src/components/provider/WechatLoginButton.jsx +37 -0
  130. package/src/components/provider/WeiboLoginButton.jsx +34 -0
  131. package/src/components/util.tsx +173 -0
  132. package/src/i18n/en/signup.json +48 -0
  133. package/src/i18n/index.ts +17 -0
  134. package/src/index.tsx +6 -1
  135. package/vite.config.ts +33 -25
@@ -0,0 +1,327 @@
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 Provider from "./Provider";
18
+ import { getProviderLogoURL } from "../forms/util/core";
19
+ import {
20
+ GithubLoginButton,
21
+ GoogleLoginButton,
22
+ } from "react-social-login-buttons";
23
+ import QqLoginButton from "./QqLoginButton";
24
+ import FacebookLoginButton from "./FacebookLoginButton";
25
+ import WeiboLoginButton from "./WeiboLoginButton";
26
+ import GiteeLoginButton from "./GiteeLoginButton";
27
+ import WechatLoginButton from "./WechatLoginButton";
28
+ import DingTalkLoginButton from "./DingTalkLoginButton";
29
+ import LinkedInLoginButton from "./LinkedInLoginButton";
30
+ import WeComLoginButton from "./WeComLoginButton";
31
+ import LarkLoginButton from "./LarkLoginButton";
32
+ import GitLabLoginButton from "./GitLabLoginButton";
33
+ import AdfsLoginButton from "./AdfsLoginButton";
34
+ import CasdoorLoginButton from "./CasdoorLoginButton";
35
+ import BaiduLoginButton from "./BaiduLoginButton";
36
+ import AlipayLoginButton from "./AlipayLoginButton";
37
+ import InfoflowLoginButton from "./InfoflowLoginButton";
38
+ import AppleLoginButton from "./AppleLoginButton";
39
+ import AzureADLoginButton from "./AzureADLoginButton";
40
+ import AzureADB2CLoginButton from "./AzureADB2CLoginButton";
41
+ import SlackLoginButton from "./SlackLoginButton";
42
+ import SteamLoginButton from "./SteamLoginButton";
43
+ import BilibiliLoginButton from "./BilibiliLoginButton";
44
+ import OktaLoginButton from "./OktaLoginButton";
45
+ import DouyinLoginButton from "./DouyinLoginButton";
46
+ import LoginButton from "./LoginButton";
47
+ import * as AuthBackend from "../forms/util/auth-api";
48
+ import { WechatOfficialAccountModal } from "../forms/util/auth-util";
49
+
50
+ function getSigninButton(provider) {
51
+ const text = i18next
52
+ .t("login:Sign in with {type}")
53
+ .replace(
54
+ "{type}",
55
+ provider.displayName !== "" ? provider.displayName : provider.type
56
+ );
57
+ if (provider.type === "GitHub") {
58
+ return <GithubLoginButton text={text} align={"center"} />;
59
+ } else if (provider.type === "Google") {
60
+ return <GoogleLoginButton text={text} align={"center"} />;
61
+ } else if (provider.type === "QQ") {
62
+ return <QqLoginButton text={text} align={"center"} />;
63
+ } else if (provider.type === "Facebook") {
64
+ return <FacebookLoginButton text={text} align={"center"} />;
65
+ } else if (provider.type === "Weibo") {
66
+ return <WeiboLoginButton text={text} align={"center"} />;
67
+ } else if (provider.type === "Gitee") {
68
+ return <GiteeLoginButton text={text} align={"center"} />;
69
+ } else if (provider.type === "WeChat") {
70
+ return <WechatLoginButton text={text} align={"center"} />;
71
+ } else if (provider.type === "DingTalk") {
72
+ return <DingTalkLoginButton text={text} align={"center"} />;
73
+ } else if (provider.type === "LinkedIn") {
74
+ return <LinkedInLoginButton text={text} align={"center"} />;
75
+ } else if (provider.type === "WeCom") {
76
+ return <WeComLoginButton text={text} align={"center"} />;
77
+ } else if (provider.type === "Lark") {
78
+ return <LarkLoginButton text={text} align={"center"} />;
79
+ } else if (provider.type === "GitLab") {
80
+ return <GitLabLoginButton text={text} align={"center"} />;
81
+ } else if (provider.type === "ADFS") {
82
+ return <AdfsLoginButton text={text} align={"center"} />;
83
+ } else if (provider.type === "Casdoor") {
84
+ return <CasdoorLoginButton text={text} align={"center"} />;
85
+ } else if (provider.type === "Baidu") {
86
+ return <BaiduLoginButton text={text} align={"center"} />;
87
+ } else if (provider.type === "Alipay") {
88
+ return <AlipayLoginButton text={text} align={"center"} />;
89
+ } else if (provider.type === "Infoflow") {
90
+ return <InfoflowLoginButton text={text} align={"center"} />;
91
+ } else if (provider.type === "Apple") {
92
+ return <AppleLoginButton text={text} align={"center"} />;
93
+ } else if (provider.type === "AzureAD") {
94
+ return <AzureADLoginButton text={text} align={"center"} />;
95
+ } else if (provider.type === "AzureADB2C") {
96
+ return <AzureADB2CLoginButton text={text} align={"center"} />;
97
+ } else if (provider.type === "Slack") {
98
+ return <SlackLoginButton text={text} align={"center"} />;
99
+ } else if (provider.type === "Steam") {
100
+ return <SteamLoginButton text={text} align={"center"} />;
101
+ } else if (provider.type === "Bilibili") {
102
+ return <BilibiliLoginButton text={text} align={"center"} />;
103
+ } else if (provider.type === "Okta") {
104
+ return <OktaLoginButton text={text} align={"center"} />;
105
+ } else if (provider.type === "Douyin") {
106
+ return <DouyinLoginButton text={text} align={"center"} />;
107
+ } else {
108
+ return (
109
+ <LoginButton
110
+ key={provider.type}
111
+ type={provider.type}
112
+ logoUrl={getProviderLogoURL(provider)}
113
+ />
114
+ );
115
+ }
116
+ }
117
+
118
+ function goToSamlUrl(provider, location) {
119
+ const params = new URLSearchParams(location.search);
120
+ const clientId = params.get("client_id") ?? "";
121
+ const state = params.get("state");
122
+ const realRedirectUri = params.get("redirect_uri");
123
+ const redirectUri = `${window.location.origin}/callback/saml`;
124
+ const providerName = provider.name;
125
+
126
+ const relayState = `${clientId}&${state}&${providerName}&${realRedirectUri}&${redirectUri}`;
127
+ AuthBackend.getSamlLogin(
128
+ `${provider.owner}/${providerName}`,
129
+ btoa(relayState)
130
+ ).then((res) => {
131
+ if (res.data2 === "POST") {
132
+ document.write(res.data);
133
+ } else {
134
+ window.location.href = res.data;
135
+ }
136
+ });
137
+ }
138
+
139
+ export function goToWeb3Url(application, provider, method) {
140
+ if (provider.type === "MetaMask") {
141
+ import("./Web3Auth").then((module) => {
142
+ const authViaMetaMask = module.authViaMetaMask;
143
+ authViaMetaMask(application, provider, method);
144
+ });
145
+ } else if (provider.type === "Web3Onboard") {
146
+ import("./Web3Auth").then((module) => {
147
+ const authViaWeb3Onboard = module.authViaWeb3Onboard;
148
+ authViaWeb3Onboard(application, provider, method);
149
+ });
150
+ }
151
+ }
152
+
153
+ export function renderProviderLogo(
154
+ provider,
155
+ application,
156
+ width,
157
+ margin,
158
+ size,
159
+ location
160
+ ) {
161
+ if (size === "small") {
162
+ if (provider.category === "OAuth") {
163
+ if (
164
+ provider.type === "WeChat" &&
165
+ provider.clientId2 !== "" &&
166
+ provider.clientSecret2 !== "" &&
167
+ provider.disableSsl === true &&
168
+ !navigator.userAgent.includes("MicroMessenger")
169
+ ) {
170
+ return (
171
+ <a key={provider.displayName}>
172
+ <img
173
+ width={width}
174
+ height={width}
175
+ src={getProviderLogoURL(provider)}
176
+ alt={provider.displayName}
177
+ className="provider-img"
178
+ style={{ margin: margin }}
179
+ onClick={() => {
180
+ WechatOfficialAccountModal(application, provider, "signup");
181
+ }}
182
+ />
183
+ </a>
184
+ );
185
+ } else {
186
+ return (
187
+ <a
188
+ key={provider.displayName}
189
+ href={Provider.getAuthUrl(application, provider, "signup")}
190
+ >
191
+ <img
192
+ width={width}
193
+ height={width}
194
+ src={getProviderLogoURL(provider)}
195
+ alt={provider.displayName}
196
+ className="provider-img"
197
+ style={{ margin: margin }}
198
+ />
199
+ </a>
200
+ );
201
+ }
202
+ } else if (provider.category === "SAML") {
203
+ return (
204
+ <a
205
+ key={provider.displayName}
206
+ onClick={() => goToSamlUrl(provider, location)}
207
+ >
208
+ <img
209
+ width={width}
210
+ height={width}
211
+ src={getProviderLogoURL(provider)}
212
+ alt={provider.displayName}
213
+ className="provider-img"
214
+ style={{ margin: margin }}
215
+ />
216
+ </a>
217
+ );
218
+ } else if (provider.category === "Web3") {
219
+ return (
220
+ <a
221
+ key={provider.displayName}
222
+ onClick={() => goToWeb3Url(application, provider, "signup")}
223
+ >
224
+ <img
225
+ width={width}
226
+ height={width}
227
+ src={getProviderLogoURL(provider)}
228
+ alt={provider.displayName}
229
+ className="provider-img"
230
+ style={{ margin: margin }}
231
+ />
232
+ </a>
233
+ );
234
+ }
235
+ } else if (provider.type === "Custom") {
236
+ // style definition
237
+ const text = i18next
238
+ .t("login:Sign in with {type}")
239
+ .replace("{type}", provider.displayName);
240
+ const customAStyle = { display: "block", height: "55px", color: "#000" };
241
+ const customButtonStyle = {
242
+ display: "flex",
243
+ alignItems: "center",
244
+ width: "calc(100% - 10px)",
245
+ height: "50px",
246
+ margin: "5px",
247
+ padding: "0 10px",
248
+ backgroundColor: "transparent",
249
+ boxShadow: "0px 1px 3px rgba(0,0,0,0.5)",
250
+ border: "0px",
251
+ borderRadius: "3px",
252
+ cursor: "pointer",
253
+ };
254
+ const customImgStyle = { justfyContent: "space-between" };
255
+ const customSpanStyle = {
256
+ textAlign: "center",
257
+ width: "100%",
258
+ fontSize: "19px",
259
+ };
260
+ if (provider.category === "OAuth") {
261
+ return (
262
+ <a
263
+ key={provider.displayName}
264
+ href={Provider.getAuthUrl(application, provider, "signup")}
265
+ style={customAStyle}
266
+ >
267
+ <div style={customButtonStyle}>
268
+ <img
269
+ width={26}
270
+ src={getProviderLogoURL(provider)}
271
+ alt={provider.displayName}
272
+ className="provider-img"
273
+ style={customImgStyle}
274
+ />
275
+ <span style={customSpanStyle}>{text}</span>
276
+ </div>
277
+ </a>
278
+ );
279
+ } else if (provider.category === "SAML") {
280
+ return (
281
+ <a
282
+ key={provider.displayName}
283
+ onClick={() => goToSamlUrl(provider, location)}
284
+ style={customAStyle}
285
+ >
286
+ <div style={customButtonStyle}>
287
+ <img
288
+ width={26}
289
+ src={getProviderLogoURL(provider)}
290
+ alt={provider.displayName}
291
+ className="provider-img"
292
+ style={customImgStyle}
293
+ />
294
+ <span style={customSpanStyle}>{text}</span>
295
+ </div>
296
+ </a>
297
+ );
298
+ }
299
+ } else {
300
+ // big button, for disable password signin
301
+ if (provider.category === "SAML") {
302
+ return (
303
+ <div key={provider.displayName} className="provider-big-img">
304
+ <a onClick={() => goToSamlUrl(provider, location)}>
305
+ {getSigninButton(provider)}
306
+ </a>
307
+ </div>
308
+ );
309
+ } else if (provider.category === "Web3") {
310
+ return (
311
+ <div key={provider.displayName} className="provider-big-img">
312
+ <a onClick={() => goToWeb3Url(application, provider, "signup")}>
313
+ {getSigninButton(provider)}
314
+ </a>
315
+ </div>
316
+ );
317
+ } else {
318
+ return (
319
+ <div key={provider.displayName} className="provider-big-img">
320
+ <a href={Provider.getAuthUrl(application, provider, "signup")}>
321
+ {getSigninButton(provider)}
322
+ </a>
323
+ </div>
324
+ );
325
+ }
326
+ }
327
+ }
@@ -0,0 +1,31 @@
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 {createButton} from "react-social-login-buttons";
16
+
17
+ function Icon({width = 24, height = 24, color}) {
18
+ return <svg xmlns="http://www.w3.org/2000/svg" height="48" width="32" viewBox="-18.15 -35.9725 157.3 215.835"><path fill="#faab07" d="M60.503 142.237c-12.533 0-24.038-4.195-31.445-10.46-3.762 1.124-8.574 2.932-11.61 5.175-2.6 1.918-2.275 3.874-1.807 4.663 2.056 3.47 35.273 2.216 44.862 1.136zm0 0c12.535 0 24.039-4.195 31.447-10.46 3.76 1.124 8.573 2.932 11.61 5.175 2.598 1.918 2.274 3.874 1.805 4.663-2.056 3.47-35.272 2.216-44.862 1.136zm0 0" /><path d="M60.576 67.119c20.698-.14 37.286-4.147 42.907-5.683 1.34-.367 2.056-1.024 2.056-1.024.005-.189.085-3.37.085-5.01C105.624 27.768 92.58.001 60.5 0 28.42.001 15.375 27.769 15.375 55.401c0 1.642.08 4.822.086 5.01 0 0 .583.615 1.65.913 5.19 1.444 22.09 5.65 43.312 5.795zm56.245 23.02c-1.283-4.129-3.034-8.944-4.808-13.568 0 0-1.02-.126-1.537.023-15.913 4.623-35.202 7.57-49.9 7.392h-.153c-14.616.175-33.774-2.737-49.634-7.315-.606-.175-1.802-.1-1.802-.1-1.774 4.624-3.525 9.44-4.808 13.568-6.119 19.69-4.136 27.838-2.627 28.02 3.239.392 12.606-14.821 12.606-14.821 0 15.459 13.957 39.195 45.918 39.413h.848c31.96-.218 45.917-23.954 45.917-39.413 0 0 9.368 15.213 12.607 14.822 1.508-.183 3.491-8.332-2.627-28.021" /><path fill="#fff" d="M49.085 40.824c-4.352.197-8.07-4.76-8.304-11.063-.236-6.305 3.098-11.576 7.45-11.773 4.347-.195 8.064 4.76 8.3 11.065.238 6.306-3.097 11.577-7.446 11.771m31.133-11.063c-.233 6.302-3.951 11.26-8.303 11.063-4.35-.195-7.684-5.465-7.446-11.77.236-6.305 3.952-11.26 8.3-11.066 4.352.197 7.686 5.468 7.449 11.773" /><path fill="#faab07" d="M87.952 49.725C86.79 47.15 75.077 44.28 60.578 44.28h-.156c-14.5 0-26.212 2.87-27.375 5.446a.863.863 0 00-.085.367.88.88 0 00.16.496c.98 1.427 13.985 8.487 27.3 8.487h.156c13.314 0 26.319-7.058 27.299-8.487a.873.873 0 00.16-.498.856.856 0 00-.085-.365" /><path d="M54.434 29.854c.199 2.49-1.167 4.702-3.046 4.943-1.883.242-3.568-1.58-3.768-4.07-.197-2.492 1.167-4.704 3.043-4.944 1.886-.244 3.574 1.58 3.771 4.07m11.956.833c.385-.689 3.004-4.312 8.427-2.993 1.425.347 2.084.857 2.223 1.057.205.296.262.718.053 1.286-.412 1.126-1.263 1.095-1.734.875-.305-.142-4.082-2.66-7.562 1.097-.24.257-.668.346-1.073.04-.407-.308-.574-.93-.334-1.362" /><path fill="#fff" d="M60.576 83.08h-.153c-9.996.12-22.116-1.204-33.854-3.518-1.004 5.818-1.61 13.132-1.09 21.853 1.316 22.043 14.407 35.9 34.614 36.1h.82c20.208-.2 33.298-14.057 34.616-36.1.52-8.723-.087-16.035-1.092-21.854-11.739 2.315-23.862 3.64-33.86 3.518" /><path fill="#eb1923" d="M32.102 81.235v21.693s9.937 2.004 19.893.616V83.535c-6.307-.357-13.109-1.152-19.893-2.3" /><path fill="#eb1923" d="M105.539 60.412s-19.33 6.102-44.963 6.275h-.153c-25.591-.172-44.896-6.255-44.962-6.275L8.987 76.57c16.193 4.882 36.261 8.028 51.436 7.845h.153c15.175.183 35.242-2.963 51.437-7.845zm0 0" /></svg>;
19
+ }
20
+
21
+ const config = {
22
+ text: "Sign in with QQ",
23
+ icon: Icon,
24
+ iconFormat: name => `fa fa-${name}`,
25
+ style: {background: "rgb(94,188,249)"},
26
+ activeStyle: {background: "rgb(76,143,208)"},
27
+ };
28
+
29
+ const QqLoginButton = createButton(config);
30
+
31
+ export default QqLoginButton;
@@ -0,0 +1,47 @@
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 {createButton} from "react-social-login-buttons";
17
+
18
+ class SelfLoginButton extends React.Component {
19
+ generateIcon() {
20
+ const avatar = this.props.account.avatar;
21
+ return () => {
22
+ return <img width={36} height={36} src={avatar} alt="Sign in with Google" />;
23
+ };
24
+ }
25
+
26
+ getAccountShowName() {
27
+ let {name, displayName} = this.props.account;
28
+ if (displayName !== "") {
29
+ name += " (" + displayName + ")";
30
+ }
31
+ return name;
32
+ }
33
+
34
+ render() {
35
+ const config = {
36
+ icon: this.generateIcon(),
37
+ iconFormat: name => `fa fa-${name}`,
38
+ style: {background: "#ffffff", color: "#000000"},
39
+ activeStyle: {background: "#eff0ee"},
40
+ };
41
+
42
+ const SelfLoginButton = createButton(config);
43
+ return <SelfLoginButton text={this.getAccountShowName()} onClick={this.props.onClick} align={"center"} />;
44
+ }
45
+ }
46
+
47
+ export default SelfLoginButton;
@@ -0,0 +1,38 @@
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 { createButton } from "react-social-login-buttons";
16
+ import { StaticBaseUrl } from "../forms/util/core";
17
+
18
+ function Icon({ width = 24, height = 24, color }) {
19
+ return (
20
+ <img
21
+ src={`${StaticBaseUrl}/buttons/slack.svg`}
22
+ alt="Sign in with Slack"
23
+ style={{ width: 24, height: 24 }}
24
+ />
25
+ );
26
+ }
27
+
28
+ const config = {
29
+ text: "Sign in with Slack",
30
+ icon: Icon,
31
+ iconFormat: (name) => `fa fa-${name}`,
32
+ style: { background: "#ffffff", color: "#000000" },
33
+ activeStyle: { background: "#ededee" },
34
+ };
35
+
36
+ const SlackLoginButton = createButton(config);
37
+
38
+ export default SlackLoginButton;
@@ -0,0 +1,38 @@
1
+ // Copyright 2022 The casbin 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 { createButton } from "react-social-login-buttons";
16
+ import { StaticBaseUrl } from "../forms/util/core";
17
+
18
+ function Icon({ width = 24, height = 24, color }) {
19
+ return (
20
+ <img
21
+ src={`${StaticBaseUrl}/buttons/steam.svg`}
22
+ alt="Sign in with Steam"
23
+ style={{ width: 24, height: 24 }}
24
+ />
25
+ );
26
+ }
27
+
28
+ const config = {
29
+ text: "Sign in with Steam",
30
+ icon: Icon,
31
+ iconFormat: (name) => `fa fa-${name}`,
32
+ style: { background: "#ffffff", color: "#000000" },
33
+ activeStyle: { background: "#ededee" },
34
+ };
35
+
36
+ const SteamLoginButton = createButton(config);
37
+
38
+ export default SteamLoginButton;
@@ -0,0 +1,34 @@
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 { createButton } from "react-social-login-buttons";
16
+ import { StaticBaseUrl } from "../forms/util/core";
17
+
18
+ function Icon({ width = 24, height = 24, color }) {
19
+ return (
20
+ <img src={`${StaticBaseUrl}/buttons/wecom.svg`} alt="Sign in with WeCom" />
21
+ );
22
+ }
23
+
24
+ const config = {
25
+ text: "Sign in with WeCom",
26
+ icon: Icon,
27
+ iconFormat: (name) => `fa fa-${name}`,
28
+ style: { background: "rgb(255,255,255)", color: "#000000" },
29
+ activeStyle: { background: "rgb(100,150,250)" },
30
+ };
31
+
32
+ const WeComLoginButton = createButton(config);
33
+
34
+ export default WeComLoginButton;