From ab8d1f71caed7bf1a7f02660fb12b28177811ad7 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Thu, 12 Nov 2015 08:10:23 +0100 Subject: [PATCH] move lowercase transformation outside SQL --- web/Obj/brisk.phh | 6 +++--- web/Obj/dbase_pgsql.phh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 7d82d56..efb360e 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -2065,7 +2065,7 @@ class Brisk if (($bdb = BriskDB::create()) != FALSE) { $bdb->users_load(); /* MLANG: "Il nickname \'%s\' è già registrato, se il suo proprietario si autentificherà verrai rinominato d\'ufficio come ghostN." */ - if ($bdb->login_exists($name_new)) { + if ($bdb->login_exists(strtolower($name_new))) { $prestr = sprintf($mlang_brisk['nickjust'][$G_lang], xcape($name_new)); $to_user .= nickserv_msg($dt, $prestr); } @@ -2364,7 +2364,7 @@ class Brisk $bdb->users_load(); if ($pass != FALSE) { // TODO: here add a method to $bdb to check if the db is available. log_auth("XXX", "auth2"); - $authenticate = $bdb->login_verify($name_new, $pass, $code); + $authenticate = $bdb->login_verify(strtolower($name_new), $pass, $code); log_auth("XXX", "authenticate: ".($authenticate != FALSE ? "TRUE" : "FALSE")); if ($authenticate != FALSE) { @@ -2376,7 +2376,7 @@ class Brisk } } else { - $login_exists = $bdb->login_exists($name_new); + $login_exists = $bdb->login_exists(strtolower($name_new)); } } else { diff --git a/web/Obj/dbase_pgsql.phh b/web/Obj/dbase_pgsql.phh index 5c187aa..4790e8b 100644 --- a/web/Obj/dbase_pgsql.phh +++ b/web/Obj/dbase_pgsql.phh @@ -138,7 +138,7 @@ class BriskDB /* check the existence of the nick in the BriskDB */ log_main("login_exists: ".$login); - $user_sql = sprintf("SELECT * FROM %susers WHERE login = lower('%s')", + $user_sql = sprintf("SELECT * FROM %susers WHERE login = '%s'", $G_dbpfx, escsql($login)); if (($user_pg = $this->query($user_sql)) != FALSE) if (pg_numrows($user_pg) == 1) -- 2.17.1