changed registration to have blank username on first load
This commit is contained in:
@@ -54,14 +54,14 @@ func Register(
|
||||
store.ClearRedirectTrack(r, "/register")
|
||||
|
||||
if r.Method == "GET" {
|
||||
renderSafely(authview.RegisterPage(details.DiscordUser.Username), s, r, w)
|
||||
renderSafely(authview.RegisterPage(""), s, r, w)
|
||||
return
|
||||
}
|
||||
username := r.FormValue("username")
|
||||
unique := false
|
||||
var user *db.User
|
||||
audit := db.NewAudit(r.RemoteAddr, r.UserAgent(), user)
|
||||
if ok := conn.WithNotifyTx(s, w, r, func(ctx context.Context, tx bun.Tx) (bool, error) {
|
||||
if ok := conn.WithWriteTx(s, w, r, func(ctx context.Context, tx bun.Tx) (bool, error) {
|
||||
unique, err = db.IsUnique(ctx, tx, (*db.User)(nil), "username", username)
|
||||
if err != nil {
|
||||
return false, errors.Wrap(err, "db.IsUsernameUnique")
|
||||
@@ -79,6 +79,7 @@ func Register(
|
||||
}
|
||||
return true, nil
|
||||
}); !ok {
|
||||
throw.InternalServiceError(s, w, r, "Registration failed", err)
|
||||
return
|
||||
}
|
||||
if !unique {
|
||||
|
||||
Reference in New Issue
Block a user