From: Roland Häder Date: Tue, 23 Oct 2012 14:19:45 +0000 (+0000) Subject: Sub ids "fixed": X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=01c0366250aa86fdddf44fd5142bf2643b8ca31a;p=mailer.git Sub ids "fixed": - ADMIN_FORCED_ADS_404 was wrong in user_subids XML template - Move alphabet for random passwords to initialize filter - Removed some chars that may look to similar to others - Other minor improvements --- diff --git a/inc/filters.php b/inc/filters.php index ccdd4176c7..39d170f9d0 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -367,6 +367,9 @@ function FILTER_INIT_RANDOMIZER () { // Simply init the randomizer with seed and _ADD value mt_srand(generateSeed() + getConfig('_ADD')); + + // Initialize array with all allowed chars + $GLOBALS['_abc'] = explode(',', 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,1,2,3,4,6,7,8,9,-,+,_,/,.'); } // Filter for removing updates diff --git a/inc/functions.php b/inc/functions.php index a941932a6c..d13b75ec43 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -89,27 +89,26 @@ function generatePassword ($length = '0', $exclude = array()) { $length = getPassLen(); } // END - if - // Initialize array with all allowed chars - $ABC = explode(',', 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9,-,+,_,/,.'); - // Exclude some entries - $ABC = array_diff($ABC, $exclude); + $localAbc = array_diff($GLOBALS['_abc'], $exclude); // Start creating password - $PASS = ''; - for ($i = '0'; $i < $length; $i++) { - $PASS .= $ABC[mt_rand(0, count($ABC) -1)]; - } // END - for + $password = ''; + while (strlen($password) < $length) { + $password .= $localAbc[mt_rand(0, count($localAbc) -1)]; + } // END - while - // When the size is below 40 we can also add additional security by scrambling - // it. Otherwise we may corrupt hashes - if (strlen($PASS) <= 40) { + /* + * When the size is below 40 we can also add additional security by + * scrambling it. Otherwise the hash may corrupted.. + */ + if (strlen($password) <= 40) { // Also scramble the password - $PASS = scrambleString($PASS); + $password = scrambleString($password); } // END - if // Return the password - return $PASS; + return $password; } // Generates a human-readable timestamp from the Uni* stamp diff --git a/inc/language/user_de.php b/inc/language/user_de.php index ba353ef6a1..9ee2e1feb1 100644 --- a/inc/language/user_de.php +++ b/inc/language/user_de.php @@ -179,6 +179,7 @@ addMessages(array( 'ADMIN_USER_ACTION_LINK_LIST_USER_SUBID' => "Sub-Ids auflisten", // Admin - list/edit/delete sub ids and stats + 'ADMIN_USER_SUBIDS_404' => "Das Mitglied {%get,generateUserProfileLink=userid%} hat noch keine Sub-Ids eingerichtet.", 'ADMIN_USER_SUBID_STATS_404' => "Das Mitglied {%get,generateUserProfileLink=userid%} hat für die Sub-Id {%get,getSubId=id%} noch keine Statistikeinträge.", 'ADMIN_USER_SUBID_NOT_ASSIGNED_404' => "Die angegebene Sub-Id-Kennung ist der Mitglieder-Id {%get,generateUserProfileLink=userid%} nicht zugewiesen oder existiert nicht.", 'ADMIN_LIST_USER_SUBID_TITLE' => "Auflisten der Sub-Ids von Mitglied {%get,generateUserProfileLink=userid%}", diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index f4558fa77f..189f3f782f 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -449,19 +449,19 @@ function doNewUserPassword ($email, $userid) { // Is the account confirmed if (getUserData('status') == 'CONFIRMED') { // Generate new password - $NEW_PASS = generatePassword(); + $newPassword = generatePassword(); // Update database SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `password`='%s' WHERE `userid`=%s LIMIT 1", array( - generateHash($NEW_PASS), + generateHash($newPassword), getUserData('userid') ), __FUNCTION__, __LINE__); // Prepare data and message for email $message = loadEmailTemplate('guest_new_password', array( - 'new_pass' => $NEW_PASS, + 'new_pass' => $newPassword, 'nickname' => $userid ), getUserData('userid')); diff --git a/templates/xml/admin/admin_list_user_subid.xml b/templates/xml/admin/admin_list_user_subid.xml index 691c25e406..7f9a24fef5 100644 --- a/templates/xml/admin/admin_list_user_subid.xml +++ b/templates/xml/admin/admin_list_user_subid.xml @@ -45,7 +45,7 @@ MA 02110-1301 USA - +