fix: show social buttons on signup page (#962)

This commit is contained in:
Ryao
2022-08-05 18:59:56 +08:00
committed by GitHub
parent 98ef766fb4
commit ea326b3513
3 changed files with 142 additions and 109 deletions

View File

@ -17,6 +17,7 @@ import {Link} from "react-router-dom";
import {Button, Checkbox, Col, Form, Input, Modal, Result, Row} from "antd";
import * as Setting from "../Setting";
import * as AuthBackend from "./AuthBackend";
import * as ProviderButton from "./ProviderButton";
import i18next from "i18next";
import * as Util from "./Util";
import {authConfig} from "./Auth";
@ -179,6 +180,14 @@ class SignupPage extends React.Component {
this.form.current.scrollToField(errorFields[0].name);
}
isProviderVisible(providerItem) {
if (this.state.mode === "signup") {
return Setting.isProviderVisibleForSignUp(providerItem);
} else {
return Setting.isProviderVisibleForSignIn(providerItem);
}
}
renderFormItem(application, signupItem) {
if (!signupItem.visible) {
return null;
@ -582,6 +591,11 @@ class SignupPage extends React.Component {
{i18next.t("signup:sign in now")}
</a>
</Form.Item>
{
application.providers.filter(providerItem => this.isProviderVisible(providerItem)).map(providerItem => {
return ProviderButton.renderProviderLogo(providerItem.provider, application, 30, 5, "small");
})
}
</Form>
);
}