From 0a461bf19e14005d8fd088bf64deaff05232d369 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Sat, 7 Aug 2021 00:14:24 +0800 Subject: [PATCH] Directly login with the only OAuth provider. --- web/src/auth/AuthCallback.js | 3 ++- web/src/auth/LoginPage.js | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/web/src/auth/AuthCallback.js b/web/src/auth/AuthCallback.js index 7dce7096..d738f16c 100644 --- a/web/src/auth/AuthCallback.js +++ b/web/src/auth/AuthCallback.js @@ -19,6 +19,7 @@ import * as AuthBackend from "./AuthBackend"; import * as Util from "./Util"; import {authConfig} from "./Auth"; import * as Setting from "../Setting"; +import i18next from "i18next"; class AuthCallback extends React.Component { constructor(props) { @@ -121,7 +122,7 @@ class AuthCallback extends React.Component {
{ (this.state.msg === null) ? ( - + ) : ( Util.renderMessageLarge(this, this.state.msg) ) diff --git a/web/src/auth/LoginPage.js b/web/src/auth/LoginPage.js index 01776d98..15123c41 100644 --- a/web/src/auth/LoginPage.js +++ b/web/src/auth/LoginPage.js @@ -14,7 +14,7 @@ import React from "react"; import {Link} from "react-router-dom"; -import {Button, Checkbox, Col, Form, Input, Result, Row} from "antd"; +import {Button, Checkbox, Col, Form, Input, Result, Row, Spin} from "antd"; import {LockOutlined, UserOutlined} from "@ant-design/icons"; import * as AuthBackend from "./AuthBackend"; import * as ApplicationBackend from "../backend/ApplicationBackend"; @@ -232,7 +232,6 @@ class LoginPage extends React.Component { initialValues={{ organization: application.organization, application: application.name, - remember: true, autoSignin: true, }} onFinish={(values) => {this.onFinish(values)}} @@ -381,6 +380,16 @@ class LoginPage extends React.Component { return Util.renderMessageLarge(this, this.state.msg); } + const visibleOAuthProviderItems = application.providers.filter(providerItem => this.isProviderVisible(providerItem)); + if (this.props.application === undefined && visibleOAuthProviderItems.length === 1) { + Setting.goToLink(Provider.getAuthUrl(application, visibleOAuthProviderItems[0].provider, "signup")); + return ( +
+ +
+ ) + } + return (