pointer struct to members crud.

This commit is contained in:
Miroslav Šedivý
2020-12-06 21:10:45 +01:00
parent 2467c94c59
commit 9ca4e04e0b
2 changed files with 75 additions and 40 deletions

View File

@ -132,6 +132,11 @@ func (manager *SessionManagerCtx) Update(id string, profile types.MemberProfile)
return fmt.Errorf("Member not found.")
}
// preserve secret if not updated
if profile.Secret == "" {
profile.Secret = session.profile.Secret
}
err := manager.database.Update(id, profile)
if err != nil {
manager.membersMu.Unlock()