From 609ef3f3b4d4cb355d80b19df1e91db258b0bbe0 Mon Sep 17 00:00:00 2001 From: sanine-a Date: Wed, 10 May 2023 15:17:18 -0500 Subject: log out after 1 hour of inactivity --- conf/create.go | 6 ++++-- conf/list.go | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'conf') diff --git a/conf/create.go b/conf/create.go index ec732d2..201149a 100644 --- a/conf/create.go +++ b/conf/create.go @@ -16,6 +16,7 @@ func hiddenPrompt(prompt string) (string, error) { if err != nil { return "", err } + fmt.Println() return strings.TrimSpace(string(bytes)), nil } @@ -30,8 +31,9 @@ var createUser = &Command{ } username := args[0] var password string + var err error if len(args) == 1 { - password, err := hiddenPrompt("Enter password: ") + password, err = hiddenPrompt("Enter password: ") if err != nil { log.Fatal(err) } confirm, err := hiddenPrompt("Confirm password: ") if err != nil { log.Fatal(err) } @@ -43,7 +45,7 @@ var createUser = &Command{ password = args[1] } - _, err := p.CreateUser(username, password) + _, err = p.CreateUser(username, password) if err != nil { log.Fatal(err) } fmt.Printf("created user %v\n", username) }, diff --git a/conf/list.go b/conf/list.go index bf3fd80..4fa3829 100644 --- a/conf/list.go +++ b/conf/list.go @@ -29,13 +29,14 @@ var listSessions = Command{ if err != nil { log.Fatal(err) } - fmt.Printf("id\tuser\tcreated\tmodified\n========================================\n") + // padding on created and modified to match RFC3339 format + fmt.Printf("user\t\tcreated \tmodified \tid\n================================================================================\n") for _, session := range sessions { user, err := p.GetById(session.UserId) if err != nil { log.Fatal(err) } - fmt.Printf("%v\t%v\n", session.Id, user.Name, session.Created.Format(time.RFC3339), session.Modified.Format(time.RFC3339)) + fmt.Printf("%v\t\t%v\t%v\t%v\n", user.Name, session.Created.Format(time.RFC3339), session.Modified.Format(time.RFC3339), session.Id) } }, } -- cgit v1.2.1