svn: /web/php-bugs/trunk/ include/functions.php www/bug-pwd-finder.php www/bug.php

From: Date: Fri, 01 Jul 2011 00:06:05 +0000
Subject: svn: /web/php-bugs/trunk/ include/functions.php www/bug-pwd-finder.php www/bug.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-11407@lists.php.net to get a copy of this message
felipe Fri, 01 Jul 2011 00:06:05 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=312744 Log: - Changed password reminder - The password now is stored as SHA-1 - New password is generated when requesting a password Changed paths: U web/php-bugs/trunk/include/functions.php U web/php-bugs/trunk/www/bug-pwd-finder.php U web/php-bugs/trunk/www/bug.php Modified: web/php-bugs/trunk/include/functions.php =================================================================== --- web/php-bugs/trunk/include/functions.php 2011-06-30 23:50:56 UTC (rev 312743) +++ web/php-bugs/trunk/include/functions.php 2011-07-01 00:06:05 UTC (rev 312744) @@ -1765,3 +1765,12 @@ response_footer($error); exit; } + + +/** + * Generates a random password + */ +function gen_passwd($length = 8) +{ + return substr(md5(uniqid(time(), true)), 0, $length); +} Modified: web/php-bugs/trunk/www/bug-pwd-finder.php =================================================================== --- web/php-bugs/trunk/www/bug-pwd-finder.php 2011-06-30 23:50:56 UTC (rev 312743) +++ web/php-bugs/trunk/www/bug-pwd-finder.php 2011-07-01 00:06:05 UTC (rev 312744) @@ -36,9 +36,17 @@ if (empty($row['passwd'])) { $errors[] = "No password found for #$bug_id bug report, sorry."; } else { + $new_passwd = gen_passwd(); + + $dbh->prepare( + 'UPDATE bugdb + SET passwd = ? + WHERE id = ? + ')->execute(array(sha1($new_passwd), $bug_id)); + $resp = bugs_mail($row['email'], "Password for {$siteBig} bug report #{$bug_id}", - "The password for {$siteBig} bug report #{$bug_id} is {$row['passwd']}", + "The password for {$siteBig} bug report #{$bug_id} has been set to: {$new_passwd}", 'From: noreply@php.net'); if ($resp) { Modified: web/php-bugs/trunk/www/bug.php =================================================================== --- web/php-bugs/trunk/www/bug.php 2011-06-30 23:50:56 UTC (rev 312743) +++ web/php-bugs/trunk/www/bug.php 2011-07-01 00:06:05 UTC (rev 312744) @@ -245,7 +245,7 @@ } elseif (isset($_POST['in']) && !isset($_POST['preview']) && $edit == 2) { // Edits submitted by original reporter for old bugs - if (!verify_bug_passwd($bug_id, $pw)) { + if (!verify_bug_passwd($bug_id, sha1($pw))) { $errors[] = 'The password you supplied was incorrect.'; } else { // allow the original reporter to see the private report info @@ -757,7 +757,7 @@ <form id="update" action="bug.php?id=<?php echo $bug_id; ?>&amp;edit=<?php echo $edit; ?>" method="post"> <?php if ($edit == 2) { - if (!isset($_POST['in']) && $pw && verify_bug_passwd($bug['id'], $pw)) { + if (!isset($_POST['in']) && $pw && verify_bug_passwd($bug['id'], sha1($pw))) { $show_bug_info = true; ?> <div class="explain"> Welcome back! Since you opted to store your bug's password in a

« previous php.webmaster (#11407) next »