fix: add missing provider buttons (#215)

Signed-off-by: sh1luo <690898835@qq.com>
This commit is contained in:
sh1luo
2021-08-01 22:10:47 +08:00
committed by GitHub
parent 1a2d85102c
commit bf77992457
3 changed files with 72 additions and 2 deletions

View File

@ -0,0 +1,32 @@
// Copyright 2021 The casbin Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import {createButton} from "react-social-login-buttons";
import {StaticBaseUrl} from "../Setting";
function Icon({ width = 24, height = 24, color }) {
return <img src={`${StaticBaseUrl}/buttons/linkedin.svg`} alt="Sign in with LinkedIn"/>;
}
const config = {
text: "Sign in with LinkedIn",
icon: Icon,
iconFormat: name => `fa fa-${name}`,
style: {background: "rgb(255,255,255)", color: "#000000"},
activeStyle: {background: "rgb(240,240,250)"},
};
const LinkedInLoginButton = createButton(config);
export default LinkedInLoginButton;

View File

@ -29,6 +29,8 @@ import GiteeLoginButton from "./GiteeLoginButton";
import WechatLoginButton from "./WechatLoginButton"; import WechatLoginButton from "./WechatLoginButton";
import WeiboLoginButton from "./WeiboLoginButton"; import WeiboLoginButton from "./WeiboLoginButton";
import i18next from "i18next"; import i18next from "i18next";
import LinkedInLoginButton from "./LinkedInLoginButton";
import WeComLoginButton from "./WeComLoginButton";
class LoginPage extends React.Component { class LoginPage extends React.Component {
constructor(props) { constructor(props) {
@ -161,9 +163,13 @@ class LoginPage extends React.Component {
return <WechatLoginButton text={text} align={"center"} /> return <WechatLoginButton text={text} align={"center"} />
} else if (type === "DingTalk") { } else if (type === "DingTalk") {
return <DingTalkLoginButton text={text} align={"center"} /> return <DingTalkLoginButton text={text} align={"center"} />
} else { } else if (type === "LinkedIn"){
return text; return <LinkedInLoginButton text={text} align={"center"} />
} else if (type === "WeCom") {
return <WeComLoginButton text={text} align={"center"} />
} }
return text;
} }
renderProviderLogo(provider, application, width, margin, size) { renderProviderLogo(provider, application, width, margin, size) {

View File

@ -0,0 +1,32 @@
// Copyright 2021 The casbin Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import {createButton} from "react-social-login-buttons";
import {StaticBaseUrl} from "../Setting";
function Icon({ width = 24, height = 24, color }) {
return <img src={`${StaticBaseUrl}/buttons/wecom.svg`} alt="Sign in with WeCom"/>;
}
const config = {
text: "Sign in with WeCom",
icon: Icon,
iconFormat: name => `fa fa-${name}`,
style: {background: "rgb(255,255,255)", color: "#000000"},
activeStyle: {background: "rgb(100,150,250)"},
};
const WeComLoginButton = createButton(config);
export default WeComLoginButton;