Log errors returned from graphql (#3562)

* Add func methods to logger
* Log errors returned from the graphql interface
* Log authentication
* Log when credentials changed
This commit is contained in:
WithoutPants
2023-04-17 15:27:25 +10:00
committed by GitHub
parent 75f22042b7
commit 32cefea524
8 changed files with 177 additions and 4 deletions

View File

@@ -228,8 +228,13 @@ func (r *mutationResolver) ConfigureGeneral(ctx context.Context, input ConfigGen
c.Set(config.GalleryCoverRegex, *input.GalleryCoverRegex)
}
if input.Username != nil {
if input.Username != nil && *input.Username != c.GetUsername() {
c.Set(config.Username, input.Username)
if *input.Password == "" {
logger.Info("Username cleared")
} else {
logger.Info("Username changed")
}
}
if input.Password != nil {
@@ -238,6 +243,11 @@ func (r *mutationResolver) ConfigureGeneral(ctx context.Context, input ConfigGen
currentPWHash := c.GetPasswordHash()
if *input.Password != currentPWHash {
if *input.Password == "" {
logger.Info("Password cleared")
} else {
logger.Info("Password changed")
}
c.SetPassword(*input.Password)
}
}