Disallow starting and ending with a space

This commit is contained in:
Andrew Pamment 2018-01-06 15:59:35 +10:00
parent 8ddf1e7ddc
commit de2bf3be15
2 changed files with 5 additions and 1 deletions

View File

@ -238,3 +238,4 @@ File exists!\r\n
\r\n\e[1;37mSearch in (\e[1;32mC\e[1;37m)urrent area or (\e[1;32mA\e[1;37m)ll areas:\e[0m
\r\n\e[1;31mPlease enter at least one keyword.\e[0m\r\n
\r\n\e[1;37mKeywords:\e[0m
\r\nUsername may not begin or end with a space\r\n

View File

@ -557,7 +557,10 @@ struct user_record *new_user() {
s_printf(get_string(167));
continue;
}
if (buffer[0] == ' ' || buffer[strlen(buffer) - 1] == ' ') {
s_printf(get_string(240));
continue;
}
for (i=0;i<strlen(buffer);i++) {
if (!(tolower(buffer[i]) >= 97 && tolower(buffer[i]) <= 122) && buffer[i] != 32 && !(buffer[i] >= '0' && buffer[i] <= '9')) {
s_printf(get_string(168));