I haven’t had much time to comb through the useraccounts core code yet, but in the meantime I wanted to mention the issue I ran into here in case it turns out I’m just doing something dumb. I’m using the useraccounts-configuration.js
file a la the “Todos” example, and have the following code in it:
//...
AccountsTemplates.addFields([
{
_id: "username",
type: "text",
displayName: "username",
required: true,
trim: true,
re: /^((?!(\bsignin\b|\bjoin\b|\badmin\b|\babout\b|\bfeedback\b|\btest\b)).)*$/,
minLength: 3,
errStr: 'Reserved username',
},
//...
The regex is meant to act as a blacklist for certain reserved names, and it works for the most part, restricting anything listed inside it (like “admin”, “about”, “join”, etc). However, I’ve found that it’s very easy to circumvent the check by first entering a valid username and then the restricted one. I haven’t done an exhaustive test, but the behavior feels intermittent (happens around 50% of the time on my local build and is currently an issue on the live website), and generally requires you to hit the “enter” key first (clicking on the “register” button seems to trigger the regex test).
I made a quick video of it happening on my local build, after I added the word “test” to the blacklist. It’s entirely possible that my regex is bad, but this seems more like an issue of when the UserAccounts core runs its validation checks. I’ll post the video once it’s finished uploading.
Thanks, all!