mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 00:56:13 +01:00
fix: add client side check for userslug #8939
This commit is contained in:
@@ -151,12 +151,12 @@ define('forum/register', [
|
|||||||
callback = callback || function () {};
|
callback = callback || function () {};
|
||||||
|
|
||||||
var username_notify = $('#username-notify');
|
var username_notify = $('#username-notify');
|
||||||
|
var userslug = slugify(username);
|
||||||
if (username.length < ajaxify.data.minimumUsernameLength) {
|
if (username.length < ajaxify.data.minimumUsernameLength || userslug.length < ajaxify.data.minimumUsernameLength) {
|
||||||
showError(username_notify, '[[error:username-too-short]]');
|
showError(username_notify, '[[error:username-too-short]]');
|
||||||
} else if (username.length > ajaxify.data.maximumUsernameLength) {
|
} else if (username.length > ajaxify.data.maximumUsernameLength) {
|
||||||
showError(username_notify, '[[error:username-too-long]]');
|
showError(username_notify, '[[error:username-too-long]]');
|
||||||
} else if (!utils.isUserNameValid(username) || !slugify(username)) {
|
} else if (!utils.isUserNameValid(username) || !userslug) {
|
||||||
showError(username_notify, '[[error:invalid-username]]');
|
showError(username_notify, '[[error:invalid-username]]');
|
||||||
} else {
|
} else {
|
||||||
Promise.allSettled([
|
Promise.allSettled([
|
||||||
|
|||||||
Reference in New Issue
Block a user