Entering an email address with square brackets at start and end causes invisible errors during Admin registration

I just setup a Discourse instance and entered an email address in square brackets, like this [myname@mydomain.tld]

I did so, because I misunderstood the prompt, which said:

Email address for admin account(s)? [mail1@example.com, mail2@example.com]: 

Or something similar and I read this as an array, thinking I needed the square brackets for the list syntax. Now, as I wanted a list with one entry I entered [myname@mydomain.tld].

I also didn’t notice the mistake when the Discourse setup script asked me to verify the information, as I still thought this was the correct syntax. The setup script also ran without issue, but then when navigating to my freshly installed Discourse domain and clicking on register I end up on a screen that looks like this:

Notice that the email in the pop-up menu also contains the square brackets, which should have tipped me off to something being wrong, but didn’t.

Actual Behavior

If you enter a username and password in the screen and choose “Register”, nothing happens. Well, a request is executed and browser briefly displays a loading bar, but the user ends up on the same page again. The log under /var/discourse/shared/standalone/log/rails/production.log also doesn’t show any error, it just says that the page was successfully rendered again.

I suppose what actually happens is that a form-validation error happens somewhere but no error is reported to the user in the browser. No email request is made to the configured SMTP server that would show the incorrectly configured email.

Expected Behavior

Either catch the invalid email address already during the input step for the setup script (this might be hard, due to complicated email naming rules, but a dumb “check for square brackets at beginning/end” might suffice) or report whatever error occured in the case back to the user, ideally in the form for registering an admin user (something like “invalid email address”).

I lost at least an hour trying to figure out why the button “wouldn’t work” and already started writing a new topic in the “installation” category here asking what I did wrong until I finally noticed that the email address in the selection looked weird.

1 Like

This is a highly unusual thing for a user to do, I’d like to see more reports of it before doing anything. Sample size of one is not how I like to allocate engineering time.


I get that and I don’t mind if you decide not to add any additional checks for email adresses during the setup script.

However, that clicking the register button fails silently without any error report neither in the browser UI nor in the logs seems like a potentially more relevant bug. After all, it can also hide any other errors that occur that might be more common.