From 9d88c7c467f8d93af4aab9ba0b6d6c01c2ffc546 Mon Sep 17 00:00:00 2001 From: sunty <1172534965@qq.com> Date: 星期四, 20 八月 2020 20:35:30 +0800 Subject: [PATCH] add get buckets contrl --- controllers/user.go | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/controllers/user.go b/controllers/user.go index 170c19f..3dd1090 100644 --- a/controllers/user.go +++ b/controllers/user.go @@ -65,6 +65,35 @@ } // @Security ApiKeyAuth +// @Summary 淇敼褰撳墠鐧诲綍鐢ㄦ埛鐨勫瘑鐮� +// @Description 淇敼褰撳墠鐧诲綍鐢ㄦ埛鐨勫瘑鐮� +// @Accept x-www-form-urlencoded +// @Produce json +// @Tags 鐢ㄦ埛 +// @Param oldPwd formData string true "鏃у瘑鐮�" +// @Param newPwd formData string true "鏂板瘑鐮�" +// @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" +// @Failure 500 {string} json "{"code":500, success:false, msg:"", data:""}" +// @Router /data/api-u/users/updatePwd [post] +func (uc UserController) UpdatePwd(c *gin.Context) { + oldPwd := c.PostForm("oldPwd") + newPwd := c.PostForm("newPwd") + if oldPwd == "" || newPwd == "" { + util.ResponseFormat(c,code.RequestParamError,"鍙傛暟鏈夎") + return + } + authDriver := auth.GenerateAuthDriver() + userM := (*authDriver).User(c) + userId := userM["id"].(string) + var userApi dbapi.UserApi + if b,_ :=userApi.UpdatePwd(userId, oldPwd, newPwd);b { + util.ResponseFormat(c,code.UpdateSuccess,"鏇存柊鎴愬姛") + } else { + util.ResponseFormat(c,code.AccountPassUnmatch,"瀵嗙爜鏈夎") + } +} + +// @Security ApiKeyAuth // @Summary 鑾峰彇褰撳墠鐢ㄦ埛淇℃伅 // @Description 鑾峰彇褰撳墠鐢ㄦ埛淇℃伅 // @Accept json @@ -155,7 +184,7 @@ // @Param userVo body controllers.UserEditVo true "鐢ㄦ埛鍙婃潈闄愪俊鎭�" // @Success 200 {string} json "{"code":200, success:true, msg:"", data:""}" // @Failure 500 {string} json "{"code":500, success:false, msg:"",data:""}" -// @Router /data/api-v/user/saveAuth [post] +// @Router /data/api-v/users/saveAuth [post] func (uc UserController) SaveAuth(c *gin.Context) { var userEditVo UserEditVo err := c.BindJSON(&userEditVo) -- Gitblit v1.8.0