From 10f23c19abe76a0d7e05e9e38d1289bb504002c3 Mon Sep 17 00:00:00 2001 From: lealife Date: Sat, 28 Nov 2015 14:28:51 +0800 Subject: [PATCH] =?UTF-8?q?group=20i18n,=20pwd=20=E9=87=8D=E7=BD=AE?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/GroupService.go | 10 +++++----- app/service/PwdService.go | 8 +++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/service/GroupService.go b/app/service/GroupService.go index a2cab44..1cb6660 100644 --- a/app/service/GroupService.go +++ b/app/service/GroupService.go @@ -185,16 +185,16 @@ func (this *GroupService) AddUser(ownUserId, groupId, userId string) (ok bool, m // groupId是否是ownUserId的? /* if !this.IsExistsGroupUser(ownUserId, groupId) { - return false, "forbidden" + return false, "forbiddenNotMyGroup" } */ if !this.isMyGroup(ownUserId, groupId) { - return false, "forbidden" + return false, "forbiddenNotMyGroup" } // 是否已存在 if db.Has(db.GroupUsers, bson.M{"GroupId": bson.ObjectIdHex(groupId), "UserId": bson.ObjectIdHex(userId)}) { - return false, "hasUsers" + return false, "userExistsInGroup" } return db.Insert(db.GroupUsers, info.GroupUser{ @@ -210,11 +210,11 @@ func (this *GroupService) DeleteUser(ownUserId, groupId, userId string) (ok bool // groupId是否是ownUserId的? /* if !this.IsExistsGroupUser(ownUserId, groupId) { - return false, "forbidden" + return false, "forbiddenNotMyGroup" } */ if !this.isMyGroup(ownUserId, groupId) { - return false, "forbidden" + return false, "forbiddenNotMyGroup" } // 删除该用户分享到本组的笔记本, 笔记 diff --git a/app/service/PwdService.go b/app/service/PwdService.go index 6e7637b..e11c369 100644 --- a/app/service/PwdService.go +++ b/app/service/PwdService.go @@ -34,6 +34,7 @@ func (this *PwdService) FindPwd(email string) (ok bool, msg string) { return } +// 重置密码时 // 修改密码 // 先验证 func (this *PwdService) UpdatePwd(token, pwd string) (bool, string) { @@ -45,11 +46,12 @@ func (this *PwdService) UpdatePwd(token, pwd string) (bool, string) { if ok, msg, tokenInfo = tokenService.VerifyToken(token, info.TokenPwd); !ok { return ok, msg } - digest, err := GenerateHash(pwd) - if err != nil { + + passwd := GenPwd(pwd) + if passwd == "" { return false, "GenerateHash error" } - passwd := string(digest) + // 修改密码之 ok = db.UpdateByQField(db.Users, bson.M{"_id": tokenInfo.UserId}, "Pwd", passwd)