Page 1 of 1

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?

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

Posted: Tue May 25, 2021 9:59 pm
by axew3
As on my test, the username creating a site together with user account, only allow a-z 0-9 (if i'm not wrong)
and user containing space leading to a loop.
But as said i will return over to check again about this, if it is true or not because could be due to cookie wrongly set: the space char is not correctly encoded but maybe i'm totally out of the way, a check about this is required.

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

Posted: Fri Jun 18, 2021 6:42 pm
by pennymachines
Hi!

I recently encountered this one on my multisite too - with spaces in usernames imported from phpBB.

Should I apply the fix above, or did you decide to do something in an update?

Cheers.

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

Posted: Fri Jun 18, 2021 8:31 pm
by axew3
Hello David, ok going to check/fix asap, if in the while you like to change do it so, but a patch is coming

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

Posted: Sat Jun 19, 2021 1:40 pm
by pennymachines
Hi Alessio,
I'll await the update in case I mess something up.
Thanks!

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

Posted: Tue Jul 06, 2021 1:27 pm
by pennymachines
I've successfully applied patch as described above. 8-)

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

Posted: Fri Oct 29, 2021 7:35 am
by axew3
Hello guys, as said into previous post i'm over for the 2.4.5 release.
Just installed a test wp mums, so that this issue will be soon fixed (or almost we'll go to see what was going wrong about this).

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

Posted: Tue Nov 02, 2021 11:54 pm
by axew3
So i just installed a multisite test and try to register an user, where users can register a new username account, but also a site.
I can confirm that the WP answer is this if i try to register an username like test . me
the answer is:
Usernames can only contain lowercase letters (a-z) and numbers.
and this is it for any setup, that can be into a wp multisite:
Registration is disabled
User accounts may be registered
Logged in users may register new sites
Both sites and user accounts can be registered
then i assume the code behavior is correct this way.

But since the integration works by email now, we can easily switch the code to be added as
testme
when it is
test . me in phpBB and wp is a multisite install.
2.4.5 is coming