Overview
Comment:Use case comparison in login
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: 6fe90ff265ab7ff3072f54459a125fdbb1f1110c833403ab9979642d8567e951
User & Date: bohwaz on 2021-04-08 19:00:20
Other Links: manifest | tags
Context
2021-04-08
19:02
Fix typo check-in: 6b5cff4310 user: bohwaz tags: trunk, stable, 1.1.0
19:00
Use case comparison in login check-in: 6fe90ff265 user: bohwaz tags: trunk, stable
18:21
Update debian dependency check-in: 57c407e2a1 user: bohwaz tags: trunk
Changes

Modified src/include/lib/Garradin/Membres/Session.php from [af7b1cc2aa] to [c299b8c9c2].

94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
		}

		return parent::isPasswordCompromised($password);
	}

	protected function getUserForLogin($login)
	{
		$champ_id = Config::getInstance()->get('champ_identifiant');
		$login = strtolower($login);

		// Ne renvoie un membre que si celui-ci a le droit de se connecter
		$query = 'SELECT m.id, m.%1$s AS login, m.passe AS password, m.secret_otp AS otp_secret
			FROM membres AS m
			INNER JOIN users_categories AS c ON c.id = m.id_category
			WHERE m.%1$s = ? AND c.perm_connect >= %2$d
			LIMIT 1;';

		$query = sprintf($query, $champ_id, self::ACCESS_READ);

		return $this->db->first($query, $login);
	}








|
<





|







94
95
96
97
98
99
100
101

102
103
104
105
106
107
108
109
110
111
112
113
114
		}

		return parent::isPasswordCompromised($password);
	}

	protected function getUserForLogin($login)
	{
		$champ_id = $config->get('champ_identifiant');


		// Ne renvoie un membre que si celui-ci a le droit de se connecter
		$query = 'SELECT m.id, m.%1$s AS login, m.passe AS password, m.secret_otp AS otp_secret
			FROM membres AS m
			INNER JOIN users_categories AS c ON c.id = m.id_category
			WHERE m.%1$s = ? COLLATE NOCASE AND c.perm_connect >= %2$d
			LIMIT 1;';

		$query = sprintf($query, $champ_id, self::ACCESS_READ);

		return $this->db->first($query, $login);
	}

Modified src/include/lib/Garradin/Utils.php from [2723f401f4] to [27532393ef].

896
897
898
899
900
901
902





903
904

905
906
907
908
909
910
911
912
913
914
            // without: 1, 10, 101, 11, 2
        }

        if (isset(self::$collator)) {
            return self::$collator->compare($a, $b);
        }






        $a = strtoupper(self::transliterateToAscii($a));
        $b = strtoupper(self::transliterateToAscii($b));


        return strcmp($a, $b);
    }

    static public function knatcasesort(array $array)
    {
        uksort($array, [self::class, 'unicodeCaseComparison']);
        return $array;
    }
}







>
>
>
>
>
|
|
>










896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
            // without: 1, 10, 101, 11, 2
        }

        if (isset(self::$collator)) {
            return self::$collator->compare($a, $b);
        }

        if (function_exists('\mb_convert_case')) {
            $a = \mb_convert_case($a, \MB_CASE_LOWER);
            $b = \mb_convert_case($b, \MB_CASE_LOWER);
        }
        else {
            $a = strtoupper(self::transliterateToAscii($a));
            $b = strtoupper(self::transliterateToAscii($b));
        }

        return strcmp($a, $b);
    }

    static public function knatcasesort(array $array)
    {
        uksort($array, [self::class, 'unicodeCaseComparison']);
        return $array;
    }
}