casdoor/web/src/auth/LoginPage.js

742 lines
26 KiB
JavaScript
Raw Normal View History

2022-02-13 23:39:27 +08:00
// Copyright 2021 The Casdoor Authors. All Rights Reserved.
2021-02-13 13:30:51 +08:00
//
// 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.
2021-02-13 12:15:19 +08:00
import React from "react";
2021-06-14 22:42:58 +08:00
import {Link} from "react-router-dom";
import {Button, Checkbox, Col, Form, Input, Result, Row, Spin, Tabs} from "antd";
2021-02-13 12:15:19 +08:00
import {LockOutlined, UserOutlined} from "@ant-design/icons";
import * as UserWebauthnBackend from "../backend/UserWebauthnBackend";
2021-02-14 15:40:57 +08:00
import * as AuthBackend from "./AuthBackend";
import * as OrganizationBackend from "../backend/OrganizationBackend";
2021-04-19 01:14:41 +08:00
import * as ApplicationBackend from "../backend/ApplicationBackend";
2021-02-14 16:59:08 +08:00
import * as Provider from "./Provider";
import * as ProviderButton from "./ProviderButton";
2021-02-14 15:40:57 +08:00
import * as Util from "./Util";
2021-03-26 21:58:19 +08:00
import * as Setting from "../Setting";
2021-10-09 21:15:57 +08:00
import SelfLoginButton from "./SelfLoginButton";
2021-04-27 22:03:22 +08:00
import i18next from "i18next";
import CustomGithubCorner from "../CustomGithubCorner";
2022-01-07 20:34:27 +08:00
import {CountDownInput} from "../common/CountDownInput";
2021-02-13 12:15:19 +08:00
2022-07-12 20:45:22 +08:00
const {TabPane} = Tabs;
2021-03-26 21:56:51 +08:00
class LoginPage extends React.Component {
2021-02-13 12:15:19 +08:00
constructor(props) {
super(props);
this.state = {
classes: props,
2021-03-20 11:34:04 +08:00
type: props.type,
2021-02-13 12:15:19 +08:00
applicationName: props.applicationName !== undefined ? props.applicationName : (props.match === undefined ? null : props.match.params.applicationName),
2022-08-06 23:47:28 +08:00
owner: props.owner !== undefined ? props.owner : (props.match === undefined ? null : props.match.params.owner),
2021-02-13 12:15:19 +08:00
application: null,
2021-06-14 22:42:58 +08:00
mode: props.mode !== undefined ? props.mode : (props.match === undefined ? null : props.match.params.mode), // "signup" or "signin"
2021-11-28 21:10:21 +08:00
isCodeSignin: false,
2021-03-20 11:34:04 +08:00
msg: null,
2021-11-28 21:10:21 +08:00
username: null,
validEmailOrPhone: false,
validEmail: false,
validPhone: false,
2022-08-06 23:54:56 +08:00
loginMethod: "password",
2021-02-13 12:15:19 +08:00
};
if (this.state.type === "cas" && props.match?.params.casApplicationName !== undefined) {
this.state.owner = props.match?.params.owner;
this.state.applicationName = props.match?.params.casApplicationName;
}
2021-02-13 12:15:19 +08:00
}
2021-03-27 11:38:15 +08:00
UNSAFE_componentWillMount() {
if (this.state.type === "login" || this.state.type === "cas") {
2021-03-20 11:34:04 +08:00
this.getApplication();
} else if (this.state.type === "code") {
this.getApplicationLogin();
} else if (this.state.type === "saml") {
this.getSamlApplication();
2021-03-20 11:34:04 +08:00
} else {
Util.showMessage("error", `Unknown authentication type: ${this.state.type}`);
}
}
getApplicationLogin() {
2021-03-20 16:51:10 +08:00
const oAuthParams = Util.getOAuthGetParameters();
AuthBackend.getApplicationLogin(oAuthParams)
2021-03-20 11:34:04 +08:00
.then((res) => {
if (res.status === "ok") {
this.setState({
application: res.data,
});
} else {
// Util.showMessage("error", res.msg);
this.setState({
application: res.data,
msg: res.msg,
});
}
});
2021-02-13 12:15:19 +08:00
}
getApplication() {
2021-02-13 23:00:43 +08:00
if (this.state.applicationName === null) {
return;
}
if (this.state.owner === null || this.state.owner === undefined || this.state.owner === "") {
ApplicationBackend.getApplication("admin", this.state.applicationName)
.then((application) => {
this.setState({
application: application,
});
2021-02-13 12:15:19 +08:00
});
} else {
OrganizationBackend.getDefaultApplication("admin", this.state.owner)
.then((res) => {
if (res.status === "ok") {
this.setState({
application: res.data,
applicationName: res.data.name,
});
} else {
Util.showMessage("error", res.msg);
}
});
}
2021-02-13 12:15:19 +08:00
}
getSamlApplication() {
if (this.state.applicationName === null) {
return;
}
ApplicationBackend.getApplication(this.state.owner, this.state.applicationName)
.then((application) => {
this.setState({
application: application,
});
2022-08-07 00:17:27 +08:00
}
);
}
2021-02-13 12:15:19 +08:00
getApplicationObj() {
if (this.props.application !== undefined) {
return this.props.application;
} else {
return this.state.application;
}
}
2021-06-20 22:17:03 +08:00
onUpdateAccount(account) {
this.props.onUpdateAccount(account);
}
2021-02-13 12:15:19 +08:00
onFinish(values) {
if (this.state.loginMethod === "webAuthn") {
let username = this.state.username;
if (username === null || username === "") {
username = values["username"];
}
this.signInWithWebAuthn(username);
return;
}
2021-06-20 22:17:03 +08:00
const application = this.getApplicationObj();
const ths = this;
// here we are supposed to determine whether Casdoor is working as an OAuth server or CAS server
if (this.state.type === "cas") {
// CAS
const casParams = Util.getCasParameters();
values["type"] = this.state.type;
AuthBackend.loginCas(values, casParams).then((res) => {
if (res.status === "ok") {
let msg = "Logged in successfully. ";
2022-04-25 20:00:57 +08:00
if (casParams.service === "") {
// If service was not specified, Casdoor must display a message notifying the client that it has successfully initiated a single sign-on session.
msg += "Now you can visit apps protected by Casdoor.";
2021-03-20 13:05:34 +08:00
}
Util.showMessage("success", msg);
if (casParams.service !== "") {
const st = res.data;
const newUrl = new URL(casParams.service);
newUrl.searchParams.append("ticket", st);
window.location.href = newUrl.toString();
}
2021-02-13 12:15:19 +08:00
} else {
2021-03-26 21:57:41 +08:00
Util.showMessage("error", `Failed to log in: ${res.msg}`);
2021-02-13 12:15:19 +08:00
}
});
} else {
// OAuth
const oAuthParams = Util.getOAuthGetParameters();
2022-08-13 11:23:16 +08:00
if (oAuthParams !== null && oAuthParams.responseType !== null && oAuthParams.responseType !== "") {
values["type"] = oAuthParams.responseType;
} else {
values["type"] = this.state.type;
}
values["phonePrefix"] = this.getApplicationObj()?.organizationObj.phonePrefix;
if (oAuthParams !== null) {
values["samlRequest"] = oAuthParams.samlRequest;
}
2022-08-13 11:23:16 +08:00
if (values["samlRequest"] !== null && values["samlRequest"] !== "" && values["samlRequest"] !== undefined) {
values["type"] = "saml";
}
if (this.state.owner !== null && this.state.owner !== undefined) {
values["organization"] = this.state.owner;
}
AuthBackend.login(values, oAuthParams)
.then((res) => {
if (res.status === "ok") {
const responseType = values["type"];
if (responseType === "login") {
Util.showMessage("success", "Logged in successfully");
const link = Setting.getFromLink();
Setting.goToLink(link);
} else if (responseType === "code") {
const code = res.data;
const concatChar = oAuthParams?.redirectUri?.includes("?") ? "&" : "?";
const noRedirect = oAuthParams.noRedirect;
if (Setting.hasPromptPage(application)) {
AuthBackend.getAccount("")
.then((res) => {
let account = null;
if (res.status === "ok") {
account = res.data;
account.organization = res.data2;
this.onUpdateAccount(account);
if (Setting.isPromptAnswered(account, application)) {
Setting.goToLink(`${oAuthParams.redirectUri}${concatChar}code=${code}&state=${oAuthParams.state}`);
} else {
Setting.goToLinkSoft(ths, `/prompt/${application.name}?redirectUri=${oAuthParams.redirectUri}&code=${code}&state=${oAuthParams.state}`);
}
} else {
Setting.showMessage("error", `Failed to sign in: ${res.msg}`);
}
});
} else {
if (noRedirect === "true") {
window.close();
const newWindow = window.open(`${oAuthParams.redirectUri}${concatChar}code=${code}&state=${oAuthParams.state}`);
if (newWindow) {
setInterval(() => {
if (!newWindow.closed) {
newWindow.close();
}
}, 1000);
}
} else {
Setting.goToLink(`${oAuthParams.redirectUri}${concatChar}code=${code}&state=${oAuthParams.state}`);
}
}
// Util.showMessage("success", `Authorization code: ${res.data}`);
} else if (responseType === "token" || responseType === "id_token") {
const accessToken = res.data;
Setting.goToLink(`${oAuthParams.redirectUri}#${responseType}=${accessToken}?state=${oAuthParams.state}&token_type=bearer`);
} else if (responseType === "saml") {
const SAMLResponse = res.data;
const redirectUri = res.data2;
Setting.goToLink(`${redirectUri}?SAMLResponse=${encodeURIComponent(SAMLResponse)}&RelayState=${oAuthParams.relayState}`);
}
} else {
Util.showMessage("error", `Failed to log in: ${res.msg}`);
}
});
}
}
2021-02-13 12:15:19 +08:00
getSamlUrl(provider) {
const params = new URLSearchParams(this.props.location.search);
const clientId = params.get("client_id");
const application = params.get("state");
const realRedirectUri = params.get("redirect_uri");
const redirectUri = `${window.location.origin}/callback/saml`;
const providerName = provider.name;
const relayState = `${clientId}&${application}&${providerName}&${realRedirectUri}&${redirectUri}`;
AuthBackend.getSamlLogin(`${provider.owner}/${providerName}`, btoa(relayState)).then((res) => {
if (res.data2 === "POST") {
document.write(res.data);
} else {
window.location.href = res.data;
}
});
}
2021-06-14 22:42:58 +08:00
isProviderVisible(providerItem) {
if (this.state.mode === "signup") {
return Setting.isProviderVisibleForSignUp(providerItem);
} else {
return Setting.isProviderVisibleForSignIn(providerItem);
}
}
2021-03-20 12:29:34 +08:00
renderForm(application) {
if (this.state.msg !== null) {
return Util.renderMessage(this.state.msg);
2021-03-20 11:34:04 +08:00
}
2021-06-14 22:42:58 +08:00
if (this.state.mode === "signup" && !application.enableSignUp) {
return (
<Result
status="error"
title="Sign Up Error"
subTitle={"The application does not allow to sign up new account"}
extra={[
<Link key="login" onClick={() => {
2021-06-14 22:42:58 +08:00
Setting.goToLogin(this, application);
}}>
<Button type="primary" key="signin">
Sign In
</Button>
2022-08-06 23:54:56 +08:00
</Link>,
2021-06-14 22:42:58 +08:00
]}
>
</Result>
);
2021-06-14 22:42:58 +08:00
}
2021-03-26 21:58:30 +08:00
if (application.enablePassword) {
return (
<Form
name="normal_login"
initialValues={{
organization: application.organization,
2021-06-20 22:17:03 +08:00
application: application.name,
2021-08-06 20:04:08 +08:00
autoSignin: true,
2021-03-26 21:58:30 +08:00
}}
onFinish={(values) => {this.onFinish(values);}}
2021-11-28 21:10:21 +08:00
style={{width: "300px"}}
2021-03-26 21:58:30 +08:00
size="large"
2021-02-13 12:15:19 +08:00
>
2021-06-21 01:01:16 +08:00
<Form.Item
style={{height: 0, visibility: "hidden"}}
name="application"
rules={[
{
required: true,
message: "Please input your application!",
2021-06-21 01:01:16 +08:00
},
]}
>
</Form.Item>
2021-04-28 21:25:58 +08:00
<Form.Item
style={{height: 0, visibility: "hidden"}}
name="organization"
rules={[
{
required: true,
message: "Please input your organization!",
2021-04-28 21:25:58 +08:00
},
]}
2021-03-26 21:58:30 +08:00
>
2021-02-13 12:15:19 +08:00
</Form.Item>
{this.renderMethodChoiceBox()}
<Row style={{minHeight: 130, alignItems: "center"}}>
<Col span={24}>
<Form.Item
name="username"
rules={[
{
required: true,
message: i18next.t("login:Please input your username, Email or phone!"),
},
{
validator: (_, value) => {
if (this.state.isCodeSignin) {
if (this.state.email !== "" && !Setting.isValidEmail(this.state.username) && !Setting.isValidPhone(this.state.username)) {
this.setState({validEmailOrPhone: false});
return Promise.reject(i18next.t("login:The input is not valid Email or Phone!"));
}
if (Setting.isValidPhone(this.state.username)) {
this.setState({validPhone: true});
}
if (Setting.isValidEmail(this.state.username)) {
this.setState({validEmail: true});
}
}
this.setState({validEmailOrPhone: true});
return Promise.resolve();
},
},
]}
>
<Input
id = "input"
prefix={<UserOutlined className="site-form-item-icon" />}
placeholder={this.state.isCodeSignin ? i18next.t("login:Email or phone") : i18next.t("login:username, Email or phone")}
disabled={!application.enablePassword}
onChange={e => {
this.setState({
username: e.target.value,
});
}}
/>
</Form.Item>
</Col>
{
this.renderPasswordOrCodeInput()
}
</Row>
2021-03-26 21:58:30 +08:00
<Form.Item>
<Form.Item name="autoSignin" valuePropName="checked" noStyle>
2021-03-26 21:58:30 +08:00
<Checkbox style={{float: "left"}} disabled={!application.enablePassword}>
2021-08-06 20:04:08 +08:00
{i18next.t("login:Auto sign in")}
2021-03-26 21:58:30 +08:00
</Checkbox>
</Form.Item>
<a style={{float: "right"}} onClick={() => {
Setting.goToForget(this, application);
}}>
{i18next.t("login:Forgot password?")}
</a>
2021-03-26 21:58:30 +08:00
</Form.Item>
<Form.Item>
{
this.state.loginMethod === "password" ?
(
<Button
type="primary"
htmlType="submit"
2022-07-12 20:45:22 +08:00
style={{width: "100%", marginBottom: "5px"}}
disabled={!application.enablePassword}
>
{i18next.t("login:Sign In")}
</Button>
) :
(
2022-08-06 23:36:20 +08:00
<Button
type="primary"
htmlType="submit"
style={{width: "100%", marginBottom: "5px"}}
disabled={!application.enablePassword}
>
{i18next.t("login:Sign in with WebAuthn")}
</Button>
)
}
2021-03-26 21:58:30 +08:00
{
this.renderFooter(application)
2021-03-26 21:58:30 +08:00
}
</Form.Item>
<Form.Item>
{
2021-06-14 22:42:58 +08:00
application.providers.filter(providerItem => this.isProviderVisible(providerItem)).map(providerItem => {
return ProviderButton.renderProviderLogo(providerItem.provider, application, 30, 5, "small");
2021-03-26 21:58:30 +08:00
})
}
</Form.Item>
</Form>
);
} else {
return (
<div style={{marginTop: "20px"}}>
2021-03-28 19:15:10 +08:00
<div style={{fontSize: 16, textAlign: "left"}}>
2021-06-11 20:33:22 +08:00
{i18next.t("login:To access")}&nbsp;
2021-03-27 11:38:15 +08:00
<a target="_blank" rel="noreferrer" href={application.homepageUrl}>
2021-03-29 22:11:28 +08:00
<span style={{fontWeight: "bold"}}>
{application.displayName}
</span>
2021-03-26 21:58:30 +08:00
</a>
2021-06-11 20:33:22 +08:00
:
2021-02-13 12:15:19 +08:00
</div>
<br />
2021-02-13 23:00:43 +08:00
{
2021-06-14 22:42:58 +08:00
application.providers.filter(providerItem => this.isProviderVisible(providerItem)).map(providerItem => {
return ProviderButton.renderProviderLogo(providerItem.provider, application, 40, 10, "big");
2021-02-13 23:00:43 +08:00
})
}
<div>
<br />
{
this.renderFooter(application)
}
</div>
2021-03-26 21:58:30 +08:00
</div>
);
2021-03-26 21:58:30 +08:00
}
2021-02-13 12:15:19 +08:00
}
2021-06-14 22:42:58 +08:00
renderFooter(application) {
if (this.state.mode === "signup") {
return (
<div style={{float: "right"}}>
{i18next.t("signup:Have account?")}&nbsp;
<Link onClick={() => {
Setting.goToLogin(this, application);
}}>
{i18next.t("signup:sign in now")}
</Link>
</div>
);
2021-06-14 22:42:58 +08:00
} else {
return (
2021-11-28 21:10:21 +08:00
<React.Fragment>
<span style={{float: "left"}}>
2021-12-31 13:36:10 +08:00
{
!application.enableCodeSignin ? null : (
<a onClick={() => {
2021-12-31 13:36:10 +08:00
this.setState({
isCodeSignin: !this.state.isCodeSignin,
});
}}>
{this.state.isCodeSignin ? i18next.t("login:Sign in with password") : i18next.t("login:Sign in with code")}
</a>
)
}
2021-11-28 21:10:21 +08:00
</span>
<span style={{float: "right"}}>
{
!application.enableSignUp ? null : (
<>
{i18next.t("login:No account?")}&nbsp;
<a onClick={() => {
sessionStorage.setItem("signinUrl", window.location.href);
Setting.goToSignup(this, application);
}}>
{i18next.t("login:sign up now")}
</a>
</>
)
}
2021-11-28 21:10:21 +08:00
</span>
</React.Fragment>
);
2021-06-14 22:42:58 +08:00
}
}
2021-10-09 21:15:57 +08:00
renderSignedInBox() {
if (this.props.account === undefined || this.props.account === null) {
if (window !== window.parent) {
const message = {tag: "Casdoor", type: "SilentSignin", data: "user-not-logged-in"};
window.parent.postMessage(message, "*");
}
2021-10-09 21:15:57 +08:00
return null;
}
const application = this.getApplicationObj();
if (this.props.account.owner !== application.organization) {
return null;
}
2021-10-09 21:15:57 +08:00
const params = new URLSearchParams(this.props.location.search);
const silentSignin = params.get("silentSignin");
2022-01-23 13:02:55 +08:00
if (silentSignin !== null) {
if (window !== window.parent) {
const message = {tag: "Casdoor", type: "SilentSignin", data: "signing-in"};
window.parent.postMessage(message, "*");
}
const values = {};
2022-01-23 13:02:55 +08:00
values["application"] = this.state.application.name;
this.onFinish(values);
}
2021-10-09 21:15:57 +08:00
return (
<div>
{/* {*/}
2022-04-25 20:00:57 +08:00
{/* JSON.stringify(silentSignin)*/}
{/* }*/}
2021-10-09 21:15:57 +08:00
<div style={{fontSize: 16, textAlign: "left"}}>
{i18next.t("login:Continue with")}&nbsp;:
</div>
<br />
2021-10-09 21:15:57 +08:00
<SelfLoginButton account={this.props.account} onClick={() => {
const values = {};
2021-10-09 21:15:57 +08:00
values["application"] = this.state.application.name;
this.onFinish(values);
}} />
<br />
<br />
2021-10-09 21:15:57 +08:00
<div style={{fontSize: 16, textAlign: "left"}}>
{i18next.t("login:Or sign in with another account")}&nbsp;:
</div>
</div>
);
2021-10-09 21:15:57 +08:00
}
signInWithWebAuthn(username) {
if (username === null || username === "") {
Setting.showMessage("error", "username is required for webauthn login");
return;
}
const application = this.getApplicationObj();
return fetch(`${Setting.ServerUrl}/api/webauthn/signin/begin?owner=${application.organization}&name=${username}`, {
method: "GET",
2022-08-06 23:54:56 +08:00
credentials: "include",
})
.then(res => res.json())
.then((credentialRequestOptions) => {
if ("status" in credentialRequestOptions) {
Setting.showMessage("error", credentialRequestOptions.msg);
throw credentialRequestOptions.status.msg;
}
credentialRequestOptions.publicKey.challenge = UserWebauthnBackend.webAuthnBufferDecode(credentialRequestOptions.publicKey.challenge);
credentialRequestOptions.publicKey.allowCredentials.forEach(function(listItem) {
listItem.id = UserWebauthnBackend.webAuthnBufferDecode(listItem.id);
});
return navigator.credentials.get({
2022-08-06 23:54:56 +08:00
publicKey: credentialRequestOptions.publicKey,
2022-07-12 20:45:22 +08:00
});
})
.then((assertion) => {
const authData = assertion.response.authenticatorData;
const clientDataJSON = assertion.response.clientDataJSON;
const rawId = assertion.rawId;
const sig = assertion.response.signature;
const userHandle = assertion.response.userHandle;
return fetch(`${Setting.ServerUrl}/api/webauthn/signin/finish`, {
method: "POST",
credentials: "include",
body: JSON.stringify({
id: assertion.id,
rawId: UserWebauthnBackend.webAuthnBufferEncode(rawId),
type: assertion.type,
response: {
authenticatorData: UserWebauthnBackend.webAuthnBufferEncode(authData),
clientDataJSON: UserWebauthnBackend.webAuthnBufferEncode(clientDataJSON),
signature: UserWebauthnBackend.webAuthnBufferEncode(sig),
userHandle: UserWebauthnBackend.webAuthnBufferEncode(userHandle),
},
2022-08-06 23:54:56 +08:00
}),
})
.then(res => res.json()).then((res) => {
if (res.msg === "") {
2022-07-12 20:45:22 +08:00
Setting.showMessage("success", "Successfully logged in with webauthn credentials");
Setting.goToLink("/");
} else {
Setting.showMessage("error", res.msg);
}
})
.catch(error => {
Setting.showMessage("error", `Failed to connect to server: ${error}`);
});
2022-07-12 20:45:22 +08:00
});
}
renderPasswordOrCodeInput() {
const application = this.getApplicationObj();
if (this.state.loginMethod === "password") {
return this.state.isCodeSignin ? (
<Col span={24}>
<Form.Item
name="code"
rules={[{required: true, message: i18next.t("login:Please input your code!")}]}
>
<CountDownInput
disabled={this.state.username?.length === 0 || !this.state.validEmailOrPhone}
onButtonClickArgs={[this.state.username, this.state.validEmail ? "email" : "phone", Setting.getApplicationName(application)]}
application={application}
/>
</Form.Item>
</Col>
) : (
<Col span={24}>
<Form.Item
name="password"
rules={[{required: true, message: i18next.t("login:Please input your password!")}]}
>
<Input
prefix={<LockOutlined className="site-form-item-icon" />}
type="password"
placeholder={i18next.t("login:Password")}
disabled={!application.enablePassword}
/>
</Form.Item>
</Col>
2022-07-12 20:45:22 +08:00
);
}
}
2022-07-12 20:45:22 +08:00
renderMethodChoiceBox() {
const application = this.getApplicationObj();
if (application.enableWebAuthn) {
return (
<div>
2022-07-12 20:45:22 +08:00
<Tabs defaultActiveKey="password" onChange={(key) => {this.setState({loginMethod: key});}} centered>
<TabPane tab={i18next.t("login:Password")} key="password" />
<TabPane tab={"WebAuthn"} key="webAuthn" />
</Tabs>
</div>
2022-07-12 20:45:22 +08:00
);
}
}
2021-02-13 12:15:19 +08:00
render() {
const application = this.getApplicationObj();
if (application === null) {
2021-03-26 21:58:19 +08:00
return Util.renderMessageLarge(this, this.state.msg);
2021-02-13 12:15:19 +08:00
}
if (application.signinHtml !== "") {
return (
<div dangerouslySetInnerHTML={{__html: application.signinHtml}} />
);
}
const visibleOAuthProviderItems = application.providers.filter(providerItem => this.isProviderVisible(providerItem));
if (this.props.application === undefined && !application.enablePassword && visibleOAuthProviderItems.length === 1) {
Setting.goToLink(Provider.getAuthUrl(application, visibleOAuthProviderItems[0].provider, "signup"));
return (
<div style={{textAlign: "center"}}>
<Spin size="large" tip={i18next.t("login:Signing in...")} style={{paddingTop: "10%"}} />
</div>
);
}
const formStyle = Setting.inIframe() ? null : Setting.parseObject(application.formCss);
2021-02-13 12:15:19 +08:00
return (
<div className="loginBackground" style={{backgroundImage: Setting.inIframe() || Setting.isMobile() ? null : `url(${application.formBackgroundUrl})`}}>
<CustomGithubCorner />
<Row >
<Col span={8} offset={application.formOffset === 0 || Setting.inIframe() || Setting.isMobile() ? 8 : application.formOffset} style={{display: "flex", justifyContent: "center"}}>
<div style={{marginTop: "80px", marginBottom: "50px", textAlign: "center", ...formStyle}}>
<div>
{
Setting.renderHelmet(application)
}
{
Setting.renderLogo(application)
}
{/* {*/}
{/* this.state.clientId !== null ? "Redirect" : null*/}
{/* }*/}
{
this.renderSignedInBox()
}
{
this.renderForm(application)
}
</div>
</div>
</Col>
</Row>
</div>
);
2021-02-13 12:15:19 +08:00
}
}
2021-03-26 21:56:51 +08:00
export default LoginPage;