forked from mtusi2026/mtusi2026lab7
lab7: безопасность, mTLS, OpenBao и PKI lifecycle
This commit is contained in:
@@ -40,6 +40,23 @@ func (r *SessionRepository) Credentials(ctx context.Context, username string) (d
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *SessionRepository) UpdatePasswordHash(
|
||||
ctx context.Context, userID uuid.UUID, oldHash, newHash string,
|
||||
) (bool, error) {
|
||||
ctx, cancel := r.store.timeout(ctx)
|
||||
defer cancel()
|
||||
|
||||
rows, err := r.store.queries.UpdatePasswordHash(ctx, sqlcgen.UpdatePasswordHashParams{
|
||||
NewHash: newHash,
|
||||
UserID: userID,
|
||||
OldHash: oldHash,
|
||||
})
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("update password hash: %w", mapError(err))
|
||||
}
|
||||
return rows != 0, nil
|
||||
}
|
||||
|
||||
func (r *SessionRepository) Create(ctx context.Context, session domain.NewSession) (domain.Session, error) {
|
||||
ctx, cancel := r.store.timeout(ctx)
|
||||
defer cancel()
|
||||
|
||||
Reference in New Issue
Block a user