|
@@ -65,21 +65,21 @@ func Send(ctx *context.Context, w http.ResponseWriter, req *http.Request) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if !ctx.IsAdmin && reqData.From.Name != ctx.UserAccount {
|
|
|
|
|
- response.NewErrorResponse(response.ParamsError, "params error", "").FPrint(w)
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if reqData.From.Email != "" {
|
|
if reqData.From.Email != "" {
|
|
|
infos := strings.Split(reqData.From.Email, "@")
|
|
infos := strings.Split(reqData.From.Email, "@")
|
|
|
if len(infos) != 2 || !array.InArray(infos[1], config.Instance.Domains) {
|
|
if len(infos) != 2 || !array.InArray(infos[1], config.Instance.Domains) {
|
|
|
response.NewErrorResponse(response.ParamsError, "params error", "").FPrint(w)
|
|
response.NewErrorResponse(response.ParamsError, "params error", "").FPrint(w)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
+ if !ctx.IsAdmin && infos[0] != ctx.UserAccount {
|
|
|
|
|
+ response.NewErrorResponse(response.ParamsError, "params error", "").FPrint(w)
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if reqData.From.Email == "" && reqData.From.Name != "" {
|
|
|
|
|
- reqData.From.Email = reqData.From.Name + "@" + config.Instance.Domain
|
|
|
|
|
|
|
+ if reqData.From.Email == "" {
|
|
|
|
|
+ reqData.From.Email = ctx.UserAccount + "@" + config.Instance.Domain
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if reqData.From.Email == "" {
|
|
if reqData.From.Email == "" {
|