|
@@ -68,6 +68,9 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo |
|
@@ -68,6 +68,9 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo |
68
|
if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) {
|
68
|
if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) {
|
69
|
err = protocol.NewErrWithMessage(2026)
|
69
|
err = protocol.NewErrWithMessage(2026)
|
70
|
}
|
70
|
}
|
|
|
71
|
+ if len(request.NewPwd)<6 {
|
|
|
72
|
+ err = protocol.NewErrWithMessage(2027)
|
|
|
73
|
+ }
|
71
|
err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd})
|
74
|
err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd})
|
72
|
return
|
75
|
return
|
73
|
}
|
76
|
}
|
|
@@ -78,15 +81,18 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass |
|
@@ -78,15 +81,18 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass |
78
|
user *models.User
|
81
|
user *models.User
|
79
|
)
|
82
|
)
|
80
|
//rsp =&protocol.ChangePasswordResponse{}
|
83
|
//rsp =&protocol.ChangePasswordResponse{}
|
|
|
84
|
+ if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) {
|
|
|
85
|
+ err = protocol.NewErrWithMessage(2026)
|
|
|
86
|
+ }
|
|
|
87
|
+ if len(request.NewPwd)<6 {
|
|
|
88
|
+ err = protocol.NewErrWithMessage(2027)
|
|
|
89
|
+ }
|
81
|
if user, err = repository.User.GetUsersById(header.Uid); err != nil {
|
90
|
if user, err = repository.User.GetUsersById(header.Uid); err != nil {
|
82
|
log.Error(err)
|
91
|
log.Error(err)
|
83
|
return
|
92
|
return
|
84
|
}
|
93
|
}
|
85
|
- if strings.EqualFold(request.OldPwd, user.Passwd) {
|
|
|
86
|
- err = protocol.NewErrWithMessage(1)
|
|
|
87
|
- }
|
|
|
88
|
- if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) {
|
|
|
89
|
- err = protocol.NewErrWithMessage(2026)
|
94
|
+ if !strings.EqualFold(request.OldPwd, user.Passwd) {
|
|
|
95
|
+ err = protocol.NewErrWithMessage(2028)
|
90
|
}
|
96
|
}
|
91
|
err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd})
|
97
|
err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd})
|
92
|
return
|
98
|
return
|