Add EnableSignUp.

This commit is contained in:
Yang Luo
2021-03-26 21:55:39 +08:00
parent da38f7a6ba
commit b6b433f26a
7 changed files with 165 additions and 139 deletions

View File

@ -152,15 +152,22 @@ func (c *ApiController) Login() {
resp = c.HandleLoggedIn(userId, &form)
} else {
//if object.IsForbidden(userId) {
// c.forbiddenAccountResp(userId)
// return
//if userId := object.GetUserIdByField(application, "email", userInfo.Email); userId != "" {
// resp = c.HandleLoggedIn(userId, &form)
//
// object.LinkUserAccount(userId, provider.Type, userInfo.Username)
//}
if userId := object.GetUserIdByField(application, "email", userInfo.Email); userId != "" {
resp = c.HandleLoggedIn(userId, &form)
object.LinkUserAccount(userId, provider.Type, userInfo.Username)
if !application.EnableSignUp {
resp = &Response{Status: "error", Msg: fmt.Sprintf("the account for provider: %s and username: %s does not exist and is not allowed to register as new account, please contact your IT support", provider.Type, userInfo.Username)}
c.Data["json"] = resp
c.ServeJSON()
return
} else {
resp = &Response{Status: "error", Msg: "need sign up"}
c.Data["json"] = resp
c.ServeJSON()
return
}
}
//resp = &Response{Status: "ok", Msg: "", Data: res}