Skip to content

Commit

Permalink
Allow password update
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Archibald committed Dec 12, 2017
1 parent b3a02ec commit aa3b909
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions backendMongo.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (b *backendMongo) CreateLogin(userID, email, password, fullName string) (*U
return nil, err
}
return &UserLogin{UserID: userID, FullName: fullName, Email: email},
m.DB("users").C("users").UpdateId(bson.ObjectIdHex(userID), bson.M{"$set": bson.M{"email": email, "passwordHash": passwordHash, "fullName": fullName}})
m.DB("users").C("users").UpdateId(bson.ObjectIdHex(userID), bson.M{"$set": bson.M{"passwordHash": passwordHash}})
}

func (b *backendMongo) CreateSecondaryEmail(userID, secondaryEmail string) error {
Expand All @@ -106,7 +106,12 @@ func (b *backendMongo) SetPrimaryEmail(userID, secondaryEmail string) error {
return nil
}
func (b *backendMongo) UpdatePassword(userID, newPassword string) error {
return nil
m := b.m.Clone()
passwordHash, err := b.c.Hash(newPassword)
if err != nil {
return err
}
return m.DB("users").C("users").UpdateId(bson.ObjectIdHex(userID), bson.M{"$set": bson.M{"passwordHash": passwordHash}})
}
func (b *backendMongo) CreateEmailSession(email, emailVerifyHash, destinationURL string) error {
return nil
Expand Down

0 comments on commit aa3b909

Please sign in to comment.