Fix #808 Remove special characters/spaces early to prevent overwrite

This commit is contained in:
Anaggh S 2020-01-01 18:04:59 +05:30
parent f48fcaf997
commit 8194be5e4d
1 changed files with 3 additions and 1 deletions

View File

@ -509,6 +509,8 @@ function createUser($args) {
global $L; global $L;
global $syslog; global $syslog;
$args['new_username'] = Text::removeSpecialCharacters($args['new_username']);
// Check empty username // Check empty username
if (Text::isEmpty($args['new_username'])) { if (Text::isEmpty($args['new_username'])) {
Alert::set($L->g('username-field-is-empty'), ALERT_STATUS_FAIL); Alert::set($L->g('username-field-is-empty'), ALERT_STATUS_FAIL);
@ -535,7 +537,7 @@ function createUser($args) {
// Filter form fields // Filter form fields
$tmp = array(); $tmp = array();
$tmp['username'] = Text::removeSpecialCharacters($args['new_username']); $tmp['username'] = $args['new_username'];
$tmp['password'] = $args['new_password']; $tmp['password'] = $args['new_password'];
$tmp['role'] = $args['role']; $tmp['role'] = $args['role'];
$tmp['email'] = $args['email']; $tmp['email'] = $args['email'];