diff options
Diffstat (limited to 'store.go')
| -rw-r--r-- | store.go | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -25,6 +25,7 @@ type Store interface { NewSession(userId int64) *Session GetUser(name string) (*User, bool) DeleteSession(id string) + ChangePassword(userId int64, hash []byte) } type PgStore struct { @@ -68,10 +69,14 @@ func (store *PgStore) NewSession(userId int64) *Session { } func (store *PgStore) DeleteSession(id string) { - store.Query("DELETE FROM sessions WHERE id = $1", id) + store.Exec("DELETE FROM sessions WHERE id = $1", id) delete(store.sessionCache, id) } +func (store *PgStore) ChangePassword(userId int64, hash []byte) { + store.Exec("UPDATE users SET password=$1 WHERE id=$2", hash, userId) +} + func (store *PgStore) GetUser(name string) (*User, bool) { u := &User{Name: name} row := store.QueryRow( |
