View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Support us on Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - How to make username case insensitive ? - ProjeQtOr
 
 

How to make username case insensitive ?

More
09 Mar 2018 13:11 #1 by fathibn
Hi,
I have ProjeQtor connected to an Active Directory for user provisionning and authentication. When a user connects, it happens that sometimes he enters his username in lowercase/uppercase ending with two different users in the postgresql projeQtor database.
How can i prevent this, forcing all usernames to be upper/lowercase ?
TIA

Please Log in or Create an account to join the conversation.

More
09 Mar 2018 18:41 #2 by babynus
Hi,

This seems an issue.
There is no "way to avoid".
We'll have to provide a fix.

Ticket #3261 recorded

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

More
09 Mar 2018 19:07 #3 by babynus
Try this patch :
In /tool/loginCheck.php, replace line 80 from
$user=new User();
to
$user=new User();
    $paramLdap_allow_login=Parameter::getGlobalParameter('paramLdap_allow_login'); // If ldap is enabled, look for username without case sensitive, as it will be stored this way.
    if (isset($paramLdap_allow_login) and strtolower($paramLdap_allow_login)=='true') {
      $crit=array('name'=>strtolower($login));
      $users=$user->getSqlElementsFromCriteria($crit,true);
      if ( count($users)==1 ) {
        $user=$users[0];
      }
    }

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

More
10 Mar 2018 09:40 #4 by fathibn
Hello and thank you for submitting a patch promptly,

I have tried with my username which is uppercase. I removed the second user (myself in lowercase), applied the patch and logged in both with upper and lowercase username. I still have a new user created with the username lowercase. I think the patch will work for new users (not yet created before the patch or whom usernames are already lowercase). For those already in the users table, maybe we should add a check to see if the user already exists and then retain the case of the user present in database, like this:
compare strtolower(username provided) to strtolower(all users in database); if there is a match, retain the username_already_existing_in_the_database as the login_provided, for subsequent ldap queries, changing its case.
As ProjeQtor aims to be multilangual, I don't know how strtolower will behave when username is in some languages like cyrilic, chinease, hebrew or arabic in which there is no uppercase .

TIA
Fathi Ben Nasr

Please Log in or Create an account to join the conversation.

More
10 Mar 2018 11:51 #5 by babynus
Yes, this quick patch controls that name in lowercase does not exist as it it will create new user with lowaercase.
So existing dupplicates with uppercase will not be detected.

Here is the patch that will fit your need :
$user=new User();
    $paramLdap_allow_login=Parameter::getGlobalParameter('paramLdap_allow_login'); // If ldap is enabled, look for username without case sensitive, as it will be stored this way.
    if (isset($paramLdap_allow_login) and strtolower($paramLdap_allow_login)=='true') {
      $critWhere="lower(name)='".strtolower($login)."'");
      $users=$user->getSqlElementsFromCriteria(null,true,$critWhere);
      if ( count($users)==1 ) {
        $user=$users[0];
      }
    }

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

More
10 Mar 2018 13:22 #6 by fathibn
Hello again,
Applied the second patch but had to revert back as no user could login to ProjeQtor, not even the local admin account.
TIA
Fathi Ben Nasr

Please Log in or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.039 seconds

Cookies settings

×

Functional Cookies

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Please login to see yours activities!

Other cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.