mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-14 10:37:45 +01:00
refactor: checkUsername function https://github.com/NodeBB/NodeBB/issues/10864
This commit is contained in:
@@ -84,17 +84,7 @@ authenticationController.register = async function (req, res) {
|
||||
await user.verifyInvitation(userData);
|
||||
}
|
||||
|
||||
if (
|
||||
!userData.username ||
|
||||
userData.username.length < meta.config.minimumUsernameLength ||
|
||||
slugify(userData.username).length < meta.config.minimumUsernameLength
|
||||
) {
|
||||
throw new Error('[[error:username-too-short]]');
|
||||
}
|
||||
|
||||
if (userData.username.length > meta.config.maximumUsernameLength) {
|
||||
throw new Error('[[error:username-too-long]]');
|
||||
}
|
||||
user.checkUsernameLength(userData.username);
|
||||
|
||||
if (userData.password !== userData['password-confirm']) {
|
||||
throw new Error('[[user:change-password-error-match]]');
|
||||
|
||||
Reference in New Issue
Block a user