mirror of
https://github.com/pocket-id/pocket-id.git
synced 2025-12-10 07:02:57 +03:00
fix: API keys not working if sqlite is used
This commit is contained in:
@@ -82,7 +82,7 @@ func (s *ApiKeyService) ValidateApiKey(apiKey string) (model.User, error) {
|
||||
hashedKey := utils.CreateSha256Hash(apiKey)
|
||||
|
||||
if err := s.db.Preload("User").Where("key = ? AND expires_at > ?",
|
||||
hashedKey, time.Now()).Preload("User").First(&key).Error; err != nil {
|
||||
hashedKey, datatype.DateTime(time.Now())).Preload("User").First(&key).Error; err != nil {
|
||||
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return model.User{}, &common.InvalidAPIKeyError{}
|
||||
|
||||
Reference in New Issue
Block a user