chore(auth): #331 add and fix session tests
This commit was merged in pull request #342.
This commit is contained in:
@@ -99,6 +99,7 @@ func (service AuthImpl) SignInSession(sessionId string) (*types.Session, *types.
|
||||
return nil, nil, types.ErrInternal
|
||||
}
|
||||
if session.ExpiresAt.Before(service.clock.Now()) {
|
||||
_ = service.db.DeleteSession(sessionId)
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
@@ -120,6 +121,8 @@ func (service AuthImpl) SignInAnonymous() (*types.Session, error) {
|
||||
return nil, types.ErrInternal
|
||||
}
|
||||
|
||||
log.Info("Anonymous session created: %v", session.Id)
|
||||
|
||||
return session, nil
|
||||
}
|
||||
|
||||
@@ -130,7 +133,6 @@ func (service AuthImpl) createSession(userId uuid.UUID) (*types.Session, error)
|
||||
}
|
||||
|
||||
err = service.db.DeleteOldSessions(userId)
|
||||
|
||||
if err != nil {
|
||||
return nil, types.ErrInternal
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ func (r *RandomImpl) Bytes(size int) ([]byte, error) {
|
||||
func (r *RandomImpl) String(size int) (string, error) {
|
||||
bytes, err := r.Bytes(size)
|
||||
if err != nil {
|
||||
log.Error("Error generating random string: %v", err)
|
||||
return "", types.ErrInternal
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user