diff options
author | sanine-a <sanine.not@pm.me> | 2023-05-10 15:17:18 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-05-10 15:17:18 -0500 |
commit | 609ef3f3b4d4cb355d80b19df1e91db258b0bbe0 (patch) | |
tree | f5681d28f031241717b72daf117b82d954e9117e /conf | |
parent | 2aac43407d7b2699d956b7c626da4f45c802c53c (diff) |
log out after 1 hour of inactivity
Diffstat (limited to 'conf')
-rw-r--r-- | conf/create.go | 6 | ||||
-rw-r--r-- | conf/list.go | 5 |
2 files changed, 7 insertions, 4 deletions
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) } }, } |