From ee0326da0ed7f35ba3e9774ee4fbec60b8d74d02 Mon Sep 17 00:00:00 2001 From: maru Date: Thu, 28 Dec 2023 21:20:46 -0500 Subject: [PATCH 1/2] Fix minimum username length --- api/account.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/account.go b/api/account.go index 9d51f1d..5696575 100644 --- a/api/account.go +++ b/api/account.go @@ -21,7 +21,7 @@ const ( argonKeyLength = 32 ) -var isValidUsername = regexp.MustCompile(`^\w{6,16}$`).MatchString +var isValidUsername = regexp.MustCompile(`^\w{1,16}$`).MatchString // /api/account/info - get account info From 9a8b816b1b9d1b96eff8a3f71162f4202547e569 Mon Sep 17 00:00:00 2001 From: maru Date: Thu, 28 Dec 2023 21:22:07 -0500 Subject: [PATCH 2/2] More verbose error response in register endpoint --- api/account.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/account.go b/api/account.go index 5696575..ee0ed2f 100644 --- a/api/account.go +++ b/api/account.go @@ -96,7 +96,7 @@ func HandleAccountRegister(w http.ResponseWriter, r *http.Request) { err = db.AddAccountRecord(uuid, request.Username, argon2.IDKey([]byte(request.Password), salt, argonTime, argonMemory, argonThreads, argonKeyLength), salt) if err != nil { - http.Error(w, "failed to add account record", http.StatusInternalServerError) + http.Error(w, fmt.Sprintf("failed to add account record: %s", err), http.StatusInternalServerError) return }