From d3a7a062d3e71fb325c22ebcb0f8b4b43ccef610 Mon Sep 17 00:00:00 2001
From: akkuman <1075768094@qq.com>
Date: Thu, 21 Apr 2022 21:52:34 +0800
Subject: [PATCH] fix #687 (#688)
fix the display bug on the personal binding information page
---
web/src/ProductBuyPage.js | 2 +-
web/src/Setting.js | 86 ++++++++++++++++++++++++++++++++++++-
web/src/auth/LoginPage.js | 4 +-
web/src/auth/Provider.js | 90 ++-------------------------------------
4 files changed, 91 insertions(+), 91 deletions(-)
diff --git a/web/src/ProductBuyPage.js b/web/src/ProductBuyPage.js
index 24527c30..9ec66f31 100644
--- a/web/src/ProductBuyPage.js
+++ b/web/src/ProductBuyPage.js
@@ -148,7 +148,7 @@ class ProductBuyPage extends React.Component {
return (
+
} size={"large"} >
{
text
diff --git a/web/src/Setting.js b/web/src/Setting.js
index 3b40287a..dd618a3b 100644
--- a/web/src/Setting.js
+++ b/web/src/Setting.js
@@ -32,6 +32,79 @@ export const StaticBaseUrl = "https://cdn.casbin.org";
// https://catamphetamine.gitlab.io/country-flag-icons/3x2/index.html
export const CountryRegionData = getCountryRegionData();
+export const OtherProviderInfo = {
+ SMS: {
+ "Aliyun SMS": {
+ logo: `${StaticBaseUrl}/img/social_aliyun.png`,
+ url: "https://aliyun.com/product/sms",
+ },
+ "Tencent Cloud SMS": {
+ logo: `${StaticBaseUrl}/img/social_tencent_cloud.jpg`,
+ url: "https://cloud.tencent.com/product/sms",
+ },
+ "Volc Engine SMS": {
+ logo: `${StaticBaseUrl}/img/social_volc_engine.jpg`,
+ url: "https://www.volcengine.com/products/cloud-sms",
+ },
+ "Huawei Cloud SMS": {
+ logo: `${StaticBaseUrl}/img/social_huawei.png`,
+ url: "https://www.huaweicloud.com/product/msgsms.html",
+ },
+ },
+ Email: {
+ "Default": {
+ logo: `${StaticBaseUrl}/img/social_default.png`,
+ url: "",
+ },
+ },
+ Storage: {
+ "Local File System": {
+ logo: `${StaticBaseUrl}/img/social_file.png`,
+ url: "",
+ },
+ "AWS S3": {
+ logo: `${StaticBaseUrl}/img/social_aws.png`,
+ url: "https://aws.amazon.com/s3",
+ },
+ "Aliyun OSS": {
+ logo: `${StaticBaseUrl}/img/social_aliyun.png`,
+ url: "https://aliyun.com/product/oss",
+ },
+ "Tencent Cloud COS": {
+ logo: `${StaticBaseUrl}/img/social_tencent_cloud.jpg`,
+ url: "https://cloud.tencent.com/product/cos",
+ },
+ },
+ SAML: {
+ "Aliyun IDaaS": {
+ logo: `${StaticBaseUrl}/img/social_aliyun.png`,
+ url: "https://aliyun.com/product/idaas"
+ },
+ "Keycloak": {
+ logo: `${StaticBaseUrl}/img/social_keycloak.png`,
+ url: "https://www.keycloak.org/"
+ },
+ },
+ Payment: {
+ "Alipay": {
+ logo: `${StaticBaseUrl}/img/payment_alipay.png`,
+ url: "https://www.alipay.com/"
+ },
+ "WeChat Pay": {
+ logo: `${StaticBaseUrl}/img/payment_wechat_pay.png`,
+ url: "https://pay.weixin.qq.com/"
+ },
+ "PayPal": {
+ logo: `${StaticBaseUrl}/img/payment_paypal.png`,
+ url: "https://www.paypal.com/"
+ },
+ "GC": {
+ logo: `${StaticBaseUrl}/img/payment_gc.png`,
+ url: "https://gc.org"
+ },
+ },
+};
+
export function getCountryRegionData() {
let language = i18next.language;
if (language === null || language === "null") {
@@ -380,9 +453,20 @@ export function getClickable(text) {
)
}
+export function getProviderLogoURL(provider) {
+ if (provider.category === "OAuth") {
+ if (provider.type === "Custom") {
+ return provider.customLogo;
+ }
+ return `${StaticBaseUrl}/img/social_${provider.type.toLowerCase()}.png`;
+ } else {
+ return OtherProviderInfo[provider.category][provider.type].logo;
+ }
+}
+
export function getProviderLogo(provider) {
const idp = provider.type.toLowerCase().trim().split(' ')[0];
- const url = `${StaticBaseUrl}/img/social_${idp}.png`;
+ const url = getProviderLogoURL(provider);
return (
)
diff --git a/web/src/auth/LoginPage.js b/web/src/auth/LoginPage.js
index 64a6cb7c..d749c0f6 100644
--- a/web/src/auth/LoginPage.js
+++ b/web/src/auth/LoginPage.js
@@ -305,13 +305,13 @@ class LoginPage extends React.Component {
if (provider.category === "OAuth") {
return (
-
+
)
} else if (provider.category === "SAML") {
return (
-
+
)
}
diff --git a/web/src/auth/Provider.js b/web/src/auth/Provider.js
index a34cbc6d..a0c3a8c9 100644
--- a/web/src/auth/Provider.js
+++ b/web/src/auth/Provider.js
@@ -112,90 +112,6 @@ const authInfo = {
},
};
-const otherProviderInfo = {
- SMS: {
- "Aliyun SMS": {
- logo: `${Setting.StaticBaseUrl}/img/social_aliyun.png`,
- url: "https://aliyun.com/product/sms",
- },
- "Tencent Cloud SMS": {
- logo: `${Setting.StaticBaseUrl}/img/social_tencent_cloud.jpg`,
- url: "https://cloud.tencent.com/product/sms",
- },
- "Volc Engine SMS": {
- logo: `${Setting.StaticBaseUrl}/img/social_volc_engine.jpg`,
- url: "https://www.volcengine.com/products/cloud-sms",
- },
- "Huawei Cloud SMS": {
- logo: `${Setting.StaticBaseUrl}/img/social_huawei.png`,
- url: "https://www.huaweicloud.com/product/msgsms.html",
- },
- },
- Email: {
- "Default": {
- logo: `${Setting.StaticBaseUrl}/img/social_default.png`,
- url: "",
- },
- },
- Storage: {
- "Local File System": {
- logo: `${Setting.StaticBaseUrl}/img/social_file.png`,
- url: "",
- },
- "AWS S3": {
- logo: `${Setting.StaticBaseUrl}/img/social_aws.png`,
- url: "https://aws.amazon.com/s3",
- },
- "Aliyun OSS": {
- logo: `${Setting.StaticBaseUrl}/img/social_aliyun.png`,
- url: "https://aliyun.com/product/oss",
- },
- "Tencent Cloud COS": {
- logo: `${Setting.StaticBaseUrl}/img/social_tencent_cloud.jpg`,
- url: "https://cloud.tencent.com/product/cos",
- },
- },
- SAML: {
- "Aliyun IDaaS": {
- logo: `${Setting.StaticBaseUrl}/img/social_aliyun.png`,
- url: "https://aliyun.com/product/idaas"
- },
- "Keycloak": {
- logo: `${Setting.StaticBaseUrl}/img/social_keycloak.png`,
- url: "https://www.keycloak.org/"
- },
- },
- Payment: {
- "Alipay": {
- logo: `${Setting.StaticBaseUrl}/img/payment_alipay.png`,
- url: "https://www.alipay.com/"
- },
- "WeChat Pay": {
- logo: `${Setting.StaticBaseUrl}/img/payment_wechat_pay.png`,
- url: "https://pay.weixin.qq.com/"
- },
- "PayPal": {
- logo: `${Setting.StaticBaseUrl}/img/payment_paypal.png`,
- url: "https://www.paypal.com/"
- },
- "GC": {
- logo: `${Setting.StaticBaseUrl}/img/payment_gc.png`,
- url: "https://gc.org"
- },
- },
-};
-
-export function getProviderLogo(provider) {
- if (provider.category === "OAuth") {
- if (provider.type === "Custom") {
- return provider.customLogo;
- }
- return `${Setting.StaticBaseUrl}/img/social_${provider.type.toLowerCase()}.png`;
- } else {
- return otherProviderInfo[provider.category][provider.type].logo;
- }
-}
-
export function getProviderUrl(provider) {
if (provider.category === "OAuth") {
const endpoint = authInfo[provider.type].endpoint;
@@ -210,7 +126,7 @@ export function getProviderUrl(provider) {
return `${urlObj.protocol}//${host}`;
} else {
- return otherProviderInfo[provider.category][provider.type].url;
+ return Setting.OtherProviderInfo[provider.category][provider.type].url;
}
}
@@ -224,14 +140,14 @@ export function getProviderLogoWidget(provider) {
return (
-
+
)
} else {
return (
-
+
)
}