mirror of
https://github.com/miniflux/v2.git
synced 2025-08-26 18:21:01 +00:00
Implement structured logging using log/slog package
This commit is contained in:
parent
54cb8fa028
commit
c0e954f19d
77 changed files with 1868 additions and 892 deletions
|
@ -5,7 +5,6 @@ package cli // import "miniflux.app/v2/internal/cli"
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"miniflux.app/v2/internal/model"
|
||||
"miniflux.app/v2/internal/storage"
|
||||
|
@ -16,27 +15,23 @@ func resetPassword(store *storage.Storage) {
|
|||
username, password := askCredentials()
|
||||
user, err := store.UserByUsername(username)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
printErrorAndExit(err)
|
||||
}
|
||||
|
||||
if user == nil {
|
||||
fmt.Fprintf(os.Stderr, "User not found!\n")
|
||||
os.Exit(1)
|
||||
printErrorAndExit(fmt.Errorf("user not found"))
|
||||
}
|
||||
|
||||
userModificationRequest := &model.UserModificationRequest{
|
||||
Password: &password,
|
||||
}
|
||||
if validationErr := validator.ValidateUserModification(store, user.ID, userModificationRequest); validationErr != nil {
|
||||
fmt.Fprintf(os.Stderr, "%s\n", validationErr)
|
||||
os.Exit(1)
|
||||
printErrorAndExit(validationErr.Error())
|
||||
}
|
||||
|
||||
user.Password = password
|
||||
if err := store.UpdateUser(user); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
printErrorAndExit(err)
|
||||
}
|
||||
|
||||
fmt.Println("Password changed!")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue