Logged in username contains illegal characters forbidden in this system

zpintar
User w
User w
Posts: 10
Joined: Tue May 11, 2021 7:17 am

Logged in username contains illegal characters forbidden in this system

Post 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?

zpintar
User w
User w
Posts: 10
Joined: Tue May 11, 2021 7:17 am

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

Post by zpintar »

My Wordpress is Multisite!

User avatar
axew3
w3all User
w3all User
Posts: 2237
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

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

Post 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

zpintar
User w
User w
Posts: 10
Joined: Tue May 11, 2021 7:17 am

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

Post by zpintar »

OK, but do you planning add this modofications in future releases of plugin?

Is this a bug or feature? :)

User avatar
axew3
w3all User
w3all User
Posts: 2237
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

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

Post 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!?

zpintar
User w
User w
Posts: 10
Joined: Tue May 11, 2021 7:17 am

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

Post 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?

User avatar
axew3
w3all User
w3all User
Posts: 2237
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

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

Post 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.

pennymachines
Moderator
Moderator
Posts: 59
Joined: Mon Feb 06, 2017 9:51 pm

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

Post 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.

User avatar
axew3
w3all User
w3all User
Posts: 2237
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

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

Post 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

pennymachines
Moderator
Moderator
Posts: 59
Joined: Mon Feb 06, 2017 9:51 pm

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

Post by pennymachines »

Hi Alessio,
I'll await the update in case I mess something up.
Thanks!

pennymachines
Moderator
Moderator
Posts: 59
Joined: Mon Feb 06, 2017 9:51 pm

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

Post by pennymachines »

I've successfully applied patch as described above. 8-)

User avatar
axew3
w3all User
w3all User
Posts: 2237
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

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

Post 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).

User avatar
axew3
w3all User
w3all User
Posts: 2237
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

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

Post 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

Post Reply