Improve login error handling.

This commit is contained in:
Yang Luo
2021-03-25 23:22:34 +08:00
parent 540adfed20
commit da38f7a6ba
4 changed files with 66 additions and 52 deletions

View File

@ -116,7 +116,10 @@ func (c *ApiController) Login() {
// https://github.com/golang/oauth2/issues/123#issuecomment-103715338
token, err := idProvider.GetToken(form.Code)
if err != nil {
panic(err)
resp = &Response{Status: "error", Msg: err.Error()}
c.Data["json"] = resp
c.ServeJSON()
return
}
if !token.Valid() {