Page 1 of 3

Logged in username contains illegal characters forbidden in this system

Posted: Wed May 12, 2021 10:14 am
by zpintar
I have a problem with phpBB usernames containing characters "-_ (space)".
If I have this allowed characters in phpBB usernames: -_ (space) I'm getting this error in Wordpress (and ca not login into WP)

Code: Select all

Notice: logged in username contains illegal characters forbidden in this system. Please contact an administrator.
Why this happened if characters like "-_ space" are allowed?

Of course, in WP I can create users with this characters (in phpBB too), but w3all throw this error in WP. Why?

Re: Logged in username contains illegal characters forbidden in this system

Posted: Wed May 12, 2021 11:37 am
by zpintar
My Wordpress is Multisite!

Re: Logged in username contains illegal characters forbidden in this system

Posted: Thu May 13, 2021 7:01 am
by axew3
About this, i was getting a loop in wp, which behavior i may will return over and fix, in the case that on multisite, users contains chars like spaces etc.
If you want to let wordpress to add any username, you could do this editing:

/wp-content/plugins/wp-w3all-phpbb-integration/class.wp.w3all-phpbb.php

where there are two lines like these:

Code: Select all

if( is_multisite() && !empty($phpbb_user_session) && preg_match('/[^0-9A-Za-z\p{Cyrillic}]/u',$phpbb_user_session[0]->username) ){
may search for

Code: Select all

if( is_multisite() && !empty($phpbb_user_session) && preg_match
will find two. Change into:

Code: Select all

if( is_multisite() && !empty($phpbb_user_session) && preg_match('/[^-0-9A-Za-z _.@\p{Cyrillic}]/u',$phpbb_user_session[0]->username) ){
note the regexp will accept default wp chars:

Code: Select all

^-0-9A-Za-z _.@
but note also as i commented at this time, little above this code:
// If it is a multisite, then Usernames can only contain lowercase letters (a-z) and numbers.
// Avoid any going on and setup as not linked this user (or get a loop)
then open wp_W3all file, you'll find 3 (beside some other commented):

Code: Select all

if ( is_multisite() && preg_match
change regexp of these with:

Code: Select all

[^-0-9A-Za-z _.@\p{Cyrillic}]
EDITED

Re: Logged in username contains illegal characters forbidden in this system

Posted: Thu May 13, 2021 7:40 am
by zpintar
OK, but do you planning add this modofications in future releases of plugin?

Is this a bug or feature? :)

Re: Logged in username contains illegal characters forbidden in this system

Posted: Thu May 13, 2021 1:20 pm
by axew3
Well, i supposed it was a correct feature, but now i'm in doubt. If i do not wrongly remember, I've see (and read?) that my multisite was accepting usernames only as 0-9a-z-A-Z but probably i'm wrong? It is only in the case that the user is also allowed to create a site, that was a multisite test where wp configured to allow this?

It could be also an option to be added, of course, if what i say just above is true: it depend by multisite config, if users allowed or not to create subsites. Maybe my deduction is totally wrong instead!?

Re: Logged in username contains illegal characters forbidden in this system

Posted: Thu May 13, 2021 3:14 pm
by zpintar
Hmm, I'm not sure that I understood well.

This problem with characters "-,_, (space)" is caused by our WP Multisite? If it is an answer, that why MU has this limitation and pure WP do not?

BTW, when I try to create WP MU user with this characters in login name, I do not get any problems and the user is created with this characters. Why then your plugin makes problem with this?