Support quick sign-in.

This commit is contained in:
Yang Luo
2021-10-09 21:15:57 +08:00
committed by RobotHuang
parent 4f2668cd90
commit 568372d077
4 changed files with 82 additions and 7 deletions

View File

@ -21,6 +21,7 @@ import * as ApplicationBackend from "../backend/ApplicationBackend";
import * as Provider from "./Provider";
import * as Util from "./Util";
import * as Setting from "../Setting";
import SelfLoginButton from "./SelfLoginButton";
import {GithubLoginButton, GoogleLoginButton} from "react-social-login-buttons";
import FacebookLoginButton from "./FacebookLoginButton";
import QqLoginButton from "./QqLoginButton";
@ -380,6 +381,31 @@ class LoginPage extends React.Component {
}
}
renderSignedInBox() {
if (this.props.account === undefined || this.props.account === null) {
return null;
}
return (
<div>
<div style={{fontSize: 16, textAlign: "left"}}>
{i18next.t("login:Continue with")}&nbsp;:
</div>
<br/>
<SelfLoginButton account={this.props.account} onClick={() => {
let values = {};
values["application"] = this.state.application.name;
this.onFinish(values);
}} />
<br/>
<br/>
<div style={{fontSize: 16, textAlign: "left"}}>
{i18next.t("login:Or sign in with another account")}&nbsp;:
</div>
</div>
)
}
render() {
const application = this.getApplicationObj();
if (application === null) {
@ -409,6 +435,9 @@ class LoginPage extends React.Component {
{/*{*/}
{/* this.state.clientId !== null ? "Redirect" : null*/}
{/*}*/}
{
this.renderSignedInBox()
}
{
this.renderForm(application)
}