Skip to content
Snippets Groups Projects
Commit 21b8b2c2 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Fix "Username already taken." validation error (could not happen)

The system.check_name() check *also* verifies that the username is not
already taken, so we must perform the matchuser() check first in order
to get the appropriate error message here when trying to use an alias
(username) that's already taken.
parent c6fde03f
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -90,10 +90,10 @@ if (system.newuser_password !== '' && (!request.has_param('newuser-password') || ...@@ -90,10 +90,10 @@ if (system.newuser_password !== '' && (!request.has_param('newuser-password') ||
reply.errors.push(locale.strings.api_register.error_bad_syspass); reply.errors.push(locale.strings.api_register.error_bad_syspass);
} }
if (!valid_param('alias', MIN_ALIAS, LEN_ALIAS) || !system.check_name(clean_param('alias'))) { if (system.matchuser(clean_param('alias')) > 0) {
reply.errors.push(locale.strings.api_register.error_invalid_alias);
} else if (system.matchuser(clean_param('alias')) > 0) {
reply.errors.push(locale.strings.api_register.error_alias_taken); reply.errors.push(locale.strings.api_register.error_alias_taken);
} else if (!valid_param('alias', MIN_ALIAS, LEN_ALIAS) || !system.check_name(clean_param('alias'))) {
reply.errors.push(locale.strings.api_register.error_invalid_alias);
} else { } else {
prepUser.alias = clean_param('alias'); prepUser.alias = clean_param('alias');
prepUser.handle = clean_param('alias'); prepUser.handle = clean_param('alias');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment