all repos — flounder @ 8d930b0741c22b9c3453beae9d7892b1191be4e2

A small site builder for the Gemini protocol

Prevent registration if user exists
alex wennerberg alex@alexwennerberg.com
Wed, 10 Feb 2021 20:18:22 -0800
commit

8d930b0741c22b9c3453beae9d7892b1191be4e2

parent

0e234b1c3807aaf2a03d3e1755b90a6fc1e5e7d3

1 files changed, 5 insertions(+), 0 deletions(-)

jump to
M http.gohttp.go

@@ -456,6 +456,11 @@ err := isOkUsername(username)

if err != nil { errors = append(errors, err.Error()) } + _, err = os.Stat(getUserDirectory(username)) + if !os.IsNotExist(err) { + // Don't allow user to create account if folder dne + errors = append(errors, "Invalid username") + } hashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), 8) // TODO handle error if err != nil { serverError(w, err)