Show
Ignore:
Timestamp:
10/30/09 14:21:05 (4 years ago)
Author:
gbastien
Message:

* Network can now be set as case insensitive. Emails are now never case sensitive and usernames' case sensitivity is consistent with network settings (#616)
* Yet again some tab alignment

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/wifidog/classes/Authenticators/AuthenticatorLocalUser.php

    r1419 r1428  
    119119        } 
    120120        else{ 
     121            /* gbastien: this is not reusable!!, why not use password directly? */ 
     122            //$password_hash = User::passwordHash($_REQUEST['password']); 
     123            $password_hash = User::passwordHash($password); 
    121124            $password = $db->escapeString($password); 
    122             $password_hash = User::passwordHash($_REQUEST['password']); 
    123  
    124             $sql = "SELECT user_id FROM users WHERE (username='$username' OR email='$username') AND account_origin='".$this->getNetwork()->getId()."' AND pass='$password_hash'"; 
     125             
     126            $comparison = ($this->getNetwork()->getUsernamesCaseSensitive()? ' = ': ' ILike '); 
     127            $sql = "SELECT user_id FROM users WHERE (username$comparison'$username' OR email$comparison'$username') AND account_origin='".$this->getNetwork()->getId()."' AND pass='$password_hash'"; 
    125128            $db->execSqlUniqueRes($sql, $user_info, false); 
    126129 
     
    141144                 */ 
    142145                $user_info = null; 
    143                 $db->execSqlUniqueRes("SELECT * FROM users WHERE (username='$username' OR email='$username') AND account_origin='".$this->getNetwork()->getId()."'", $user_info, false); 
     146                $db->execSqlUniqueRes("SELECT * FROM users WHERE (username$comparison'$username' OR email$comparison'$username') AND account_origin='".$this->getNetwork()->getId()."'", $user_info, false); 
    144147 
    145148                if ($user_info == null) {