From d11bb49eace67ecacb6a4ec1c33f73874597893f Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Fri, 26 Mar 2021 21:58:19 +0800 Subject: [PATCH] Improve login failure handling. --- controllers/auth.go | 2 +- web/src/App.js | 8 ++++++-- web/src/ApplicationEditPage.js | 2 +- web/src/Setting.js | 4 ++++ web/src/auth/AuthCallback.js | 19 ++++++++----------- web/src/auth/LoginPage.js | 7 ++++--- web/src/auth/Util.js | 12 ++++-------- web/src/basic/SingleCard.js | 7 ++++--- 8 files changed, 32 insertions(+), 29 deletions(-) diff --git a/controllers/auth.go b/controllers/auth.go index 20b6bcee..2f891764 100644 --- a/controllers/auth.go +++ b/controllers/auth.go @@ -164,7 +164,7 @@ func (c *ApiController) Login() { c.ServeJSON() return } else { - resp = &Response{Status: "error", Msg: "need sign up"} + resp = &Response{Status: "error", Msg: fmt.Sprintf("the account for provider: %s and username: %s does not exist, please register an account first", provider.Type, userInfo.Username)} c.Data["json"] = resp c.ServeJSON() return diff --git a/web/src/App.js b/web/src/App.js index 86fbc233..7911866f 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -134,7 +134,7 @@ class App extends Component { Setting.showMessage("success", `Successfully logged out, redirected to homepage`); - Setting.goToLink("/"); + Setting.goToLinkSoft(this, "/"); } else { Setting.showMessage("error", `Failed to log out: ${res.msg}`); } @@ -292,7 +292,11 @@ class App extends Component {
{ - Setting.isMobile() ? null : + Setting.isMobile() ? null : ( + +
+ + ) } -