From ff252df692c5d3f7e4b7c325468934da2ae719f5 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 19 Apr 2023 04:01:03 +0200 Subject: [PATCH] handlers: streamline SignupPost --- handlers/handlers.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/handlers/handlers.go b/handlers/handlers.go index 78836fd..8efc5a0 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -332,16 +332,18 @@ func SignupPost(client *ent.Client) echo.HandlerFunc { username = uname if passwd := c.Request().FormValue("password"); passwd != "" { ctx := context.WithValue(context.Background(), "logger", log) - if u, err := moduser.CreateUser(ctx, client, username, passwd); err != nil { + + u, err := moduser.CreateUser(ctx, client, username, passwd) + if err != nil { // TODO: don't return the error to the user, perhaps based // on the devel mode. return echo.NewHTTPError( http.StatusInternalServerError, http.StatusText(http.StatusInternalServerError)+" failed to create schema resources "+err.Error(), ) - } else { - log.Infof("successfully registered user '%s': %#v", username, u) } + + log.Infof("successfully registered user '%s': %#v", username, u) } else { log.Info("user registration: password was not set, returning to /signup") }