mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 11:20:18 +08:00
Add CheckUserPassword() API.
This commit is contained in:
@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user