feat: support google one tap signin (#2131)

* feat: add google one tap support

* feat: gofumpt

* feat: add google provider rule conf

* feat: update i18n
This commit is contained in:
haiwu
2023-07-25 15:49:15 +08:00
committed by GitHub
parent bfe8e5f3e7
commit d1f88ca9b8
17 changed files with 170 additions and 14 deletions

View File

@ -36,7 +36,7 @@ import {CaptchaModal} from "../common/modal/CaptchaModal";
import {CaptchaRule} from "../common/modal/CaptchaModal";
import RedirectForm from "../common/RedirectForm";
import {MfaAuthVerifyForm, NextMfa, RequiredMfa} from "./mfa/MfaAuthVerifyForm";
import {GoogleOneTapLoginVirtualButton} from "./GoogleLoginButton";
class LoginPage extends React.Component {
constructor(props) {
super(props);
@ -423,6 +423,16 @@ class LoginPage extends React.Component {
}
}
renderOtherFormProvider(application) {
for (const providerConf of application.providers) {
if (providerConf.provider?.type === "Google" && providerConf.rule === "OneTap" && this.props.preview !== "auto") {
return (
<GoogleOneTapLoginVirtualButton application={application} providerConf={providerConf} />
);
}
}
}
renderForm(application) {
if (this.state.msg !== null) {
return Util.renderMessage(this.state.msg);
@ -580,6 +590,9 @@ class LoginPage extends React.Component {
return ProviderButton.renderProviderLogo(providerItem.provider, application, 30, 5, "small", this.props.location);
})
}
{
this.renderOtherFormProvider(application)
}
</Form.Item>
</Form>
);
@ -601,6 +614,9 @@ class LoginPage extends React.Component {
return ProviderButton.renderProviderLogo(providerItem.provider, application, 40, 10, "big", this.props.location);
})
}
{
this.renderOtherFormProvider(application)
}
<div>
<br />
{