diff --git a/proxyserver/main.go b/proxyserver/main.go index a9b6102d..26e1a10a 100644 --- a/proxyserver/main.go +++ b/proxyserver/main.go @@ -85,12 +85,12 @@ func main() { fs := http.FileServer(http.Dir(vueBuild)) indexHtmlPath := vueBuild + "/index.html" mux.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - err := r.ParseMultipartForm(100 << 20) - if err != nil { - logx.Error(err) - } - if strings.HasPrefix(r.URL.Path, "/api/") { + err := r.ParseMultipartForm(100 << 20) + if err != nil { + logx.Error(err) + } + // 对/api开头的请求进行反向代理 proxy := httputil.NewSingleHostReverseProxy(apiURL) proxy.ServeHTTP(w, r) diff --git a/server/auth/internal/logic/userregisterlogic.go b/server/auth/internal/logic/userregisterlogic.go index 513c2ac2..03c3bece 100644 --- a/server/auth/internal/logic/userregisterlogic.go +++ b/server/auth/internal/logic/userregisterlogic.go @@ -41,6 +41,11 @@ func (l *UserRegisterLogic) UserRegister(req *types.RequestUserRegister, userinf return resp.SetStatus(basic.CodeOAuthEmailErr) } + _, err := l.svcCtx.AllModels.FsUser.FindUserByEmail(l.ctx, req.Email) + if err == nil { + return resp.SetStatus(basic.CodeEmailExistsErr) + } + token := &auth.RegisterToken{ OperateType: auth.OpTypeRegister, GuestId: userinfo.GuestId, diff --git a/utils/basic/basic.go b/utils/basic/basic.go index 6a5fb585..07e2f2b0 100644 --- a/utils/basic/basic.go +++ b/utils/basic/basic.go @@ -55,6 +55,7 @@ var ( CodeEmailNotFoundErr = &StatusResponse{5050, "email not found"} // 未找到email CodeUserIdNotFoundErr = &StatusResponse{5051, "user not found"} // 未找到用户 CodePasswordErr = &StatusResponse{5052, "invalid password"} // 无效密码 + CodeEmailExistsErr = &StatusResponse{5053, "email exists"} // email存在 CodeSafeValueRangeErr = &StatusResponse{5040, "value not in range"} // 值不在范围内 CodeTemplateErr = &StatusResponse{5040, "template parsed error"} // 模板解析错误