Add CheckUserPassword() API.

This commit is contained in:
Yang Luo
2021-08-15 21:57:36 +08:00
parent 8674b4853a
commit 398ba19fa5
5 changed files with 19 additions and 3 deletions

View File

@ -185,7 +185,7 @@ func (c *ApiController) Login() {
}
} else {
password := form.Password
user, msg = object.CheckUserLogin(form.Organization, form.Username, password)
user, msg = object.CheckUserPassword(form.Organization, form.Username, password)
}
if msg != "" {

View File

@ -231,3 +231,18 @@ func (c *ApiController) SetPassword() {
c.Data["json"] = Response{Status: "ok"}
c.ServeJSON()
}
func (c *ApiController) CheckUserPassword() {
var user object.User
err := json.Unmarshal(c.Ctx.Input.RequestBody, &user)
if err != nil {
panic(err)
}
_, msg := object.CheckUserPassword(user.Owner, user.Name, user.Password)
if msg == "" {
c.ResponseOk()
} else {
c.ResponseError(msg)
}
}