mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-16 18:10:18 +00: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)
|
hashedKey := utils.CreateSha256Hash(apiKey)
|
||||||
|
|
||||||
if err := s.db.Preload("User").Where("key = ? AND expires_at > ?",
|
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) {
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
return model.User{}, &common.InvalidAPIKeyError{}
|
return model.User{}, &common.InvalidAPIKeyError{}
|
||||||
|
|||||||
Reference in New Issue
Block a user