summaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2023-05-10 15:17:18 -0500
committersanine-a <sanine.not@pm.me>2023-05-10 15:17:18 -0500
commit609ef3f3b4d4cb355d80b19df1e91db258b0bbe0 (patch)
treef5681d28f031241717b72daf117b82d954e9117e /conf
parent2aac43407d7b2699d956b7c626da4f45c802c53c (diff)
log out after 1 hour of inactivity
Diffstat (limited to 'conf')
-rw-r--r--conf/create.go6
-rw-r--r--conf/list.go5
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)
}
},
}