From 19bbba0f3ea02f3dd8f977cdafcd74b099383032 Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Fri, 16 Sep 2022 19:06:14 +0100 Subject: [PATCH] add username check to /sign-up defroute. Just an extra check in amongst what's already there. If the username the new sign-up attempt has entered matched one already in the database, a message is relayed stating as much and redirects back to the sign-up page. --- src/web.lisp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/web.lisp b/src/web.lisp index 814d3c3..a29ceed 100644 --- a/src/web.lisp +++ b/src/web.lisp @@ -84,6 +84,9 @@ (lack.request:request-body-parameters ningle:*request*)) (cond ((not (string= authenticity-token (auth:csrf-token))) `(,+forbidden+ (:content-type "text/plain") ("Denied"))) + ((not (null (nera:get-user username))) + (utils:set-alert "Username already taken.") + (redirect "/sign-up")) ((not (string= password password-check)) (utils:set-alert "Passwords don't match.") (redirect "/sign-up"))