# HG changeset patch # User Matti Hamalainen # Date 1485386852 -7200 # Node ID 00632d30bafecadd4e07815255b82afd091b0ee7 # Parent 4f132374df75bf59f4a232eb8c9708ab72021503 Implement new settings for making user/votekeys case-insensitive and setting the array of characters used for generating keys in the config. diff -r 4f132374df75 -r 00632d30bafe mconfig.inc.php.example --- a/mconfig.inc.php.example Thu Jan 26 00:48:34 2017 +0200 +++ b/mconfig.inc.php.example Thu Jan 26 01:27:32 2017 +0200 @@ -26,8 +26,10 @@ // Default page "defaultPage" => "about", // Default page - // Vote key length in characters - "userKeyLength" => 8, + // User key/votekey settings + "userKeyLength" => 6, // Vote key length in characters + //"userKeyCase" => true, // If false, keys are case-INsensitive + //"userKeyChars" => "abdefghjkmnpqrstwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789", // Characters to be used for key generation // Voting settings "voteMin" => -1, diff -r 4f132374df75 -r 00632d30bafe msite.inc.php --- a/msite.inc.php Thu Jan 26 00:48:34 2017 +0200 +++ b/msite.inc.php Thu Jan 26 01:27:32 2017 +0200 @@ -557,7 +557,15 @@ function stGenerateUserKey() { global $db; + + // Default keychars $keyChars = "abdefghjkmnpqrstwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; + + if (($tmp = stGetSetting("userKeyChars", NULL)) !== NULL) + $keyChars = $tmp; + + if (($tmp = stGetSetting("userKeyCase", NULL)) !== NULL) + $keyChars = strtoupper($keyChars); while (TRUE) { diff -r 4f132374df75 -r 00632d30bafe usrlogin.php --- a/usrlogin.php Thu Jan 26 00:48:34 2017 +0200 +++ b/usrlogin.php Thu Jan 26 01:27:32 2017 +0200 @@ -26,6 +26,9 @@ $gotoPage = stGetRequestItem("goto", FALSE); $errorPage = stGetRequestItem("error", FALSE); $password = stGetRequestItem("key", FALSE); +if (stGetSetting("userKeyCase", NULL) === FALSE) + $password = strtoupper($password); + $error = 0; $sql = stPrepareSQL("SELECT * FROM votekeys WHERE key=%s", $password);