Problem logging in to web interface when user name contains a "-"
-
Server
- FOG Version: 1.3.0 stable (revision 6050)
- OS: Ubuntu 14.04
Client
- Service Version: n/a
- OS: n/a
Description
I upgraded a server (from 1.3.0 RC25, revision 6020), where the user name contains a “-”. In RC25 the login worked correctly, in 1.3.0 final it won’t anymore and gives the message “invalid login” back.
After trying to find out why it doesn’t work for some time I simply removed the “-” from the user name by editing it in the database directly and it worked instantly with the edited username.
-
If you want to download to give this a shot:
Immediately would be:
wget -O /var/www/fog/lib/fog/user.class.php https://raw.githubusercontent.com/FOGProject/fogproject/working-RC-6/packages/web/lib/fog/user.class.php
If you also use ldap plugin you might need:
wget -O /var/www/fog/lib/plugins/ldap/class/ldap.class.php https://raw.githubusercontent.com/FOGProject/fogproject/working-RC-6/packages/web/lib/plugins/ldap/class/ldap.class.php
-
Typically speaking, usernames don’t contain dashes and I’ve been working to improve checking of things so we have more suitable allowances for things.
I’ve updated the regex and this new regex should work for ldap and the main username now.
The regex I’m using is:
/(?=^.{3,40}$)^[\w][\w0-9]*[._-]?[\w0-9]*[.]?[\w0-9]+$/
What this translates too:
Must be at least 3 characters.
Must be no greater than 40 characters.
Must start with a word character (not number, character, etc…)
Can have up to two periods (non-contiguous) test.user.decimals is valid. test…userdecimals is not.
Only one underscore or - in the username.Hopefully this will address the issues you saw and let you log back in.
-
If you want to download to give this a shot:
Immediately would be:
wget -O /var/www/fog/lib/fog/user.class.php https://raw.githubusercontent.com/FOGProject/fogproject/working-RC-6/packages/web/lib/fog/user.class.php
If you also use ldap plugin you might need:
wget -O /var/www/fog/lib/plugins/ldap/class/ldap.class.php https://raw.githubusercontent.com/FOGProject/fogproject/working-RC-6/packages/web/lib/plugins/ldap/class/ldap.class.php
-
@Tom-Elliott Thanks for the solution. I’m using the new user.class.php now (renamed the not working one before) and the login with the previous user name (only letters and one “-” in the middle) is ok again.
(Since we don’t use the ldap integration I didn’t test the ldap.class.php)