cvs: pearweb /public_html account-edit.php

From: Date: Sat, 31 May 2008 20:12:42 +0000
Subject: cvs: pearweb /public_html account-edit.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-7585@lists.php.net to get a copy of this message
dufuz Sat May 31 20:12:42 2008 UTC Modified files: /pearweb/public_html account-edit.php Log: Add a note about a FIXME add a note where we'll be adding the svn push Fix up that weird code David commited and reduce quite a lot http://cvs.php.net/viewvc.cgi/pearweb/public_html/account-edit.php?r1=1.62&r2=1.63&diff_format=u Index: pearweb/public_html/account-edit.php diff -u pearweb/public_html/account-edit.php:1.62 pearweb/public_html/account-edit.php:1.63 --- pearweb/public_html/account-edit.php:1.62 Tue Jan 29 16:21:33 2008 +++ pearweb/public_html/account-edit.php Sat May 31 20:12:42 2008 @@ -15,7 +15,7 @@ +----------------------------------------------------------------------+ | Authors: | +----------------------------------------------------------------------+ - $Id: account-edit.php,v 1.62 2008/01/29 16:21:33 davidc Exp $ + $Id: account-edit.php,v 1.63 2008/05/31 20:12:42 dufuz Exp $ */ include_once 'HTML/QuickForm.php'; @@ -38,6 +38,7 @@ ob_start(); +// FIXME uses a hardcoded api key, bad bad bad $map = ' <script language="javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjPqDvnoTwt1l2d9kE7aeSRSaX3uuPis-gsi6PocQln0mfq-TehSSt5OZ9q0OyzKSOAfNu8NuLlNgWA"></script> '; @@ -157,41 +158,22 @@ case 'change_password': include_once 'pear-database-user.php'; $user = user::info($handle, 'password', true, false); + // If it's an admin we can change ones password without knowing {{{ // it's old password. - if ($auth_user->isAdmin()) { - - if ($_POST['password'] != $_POST['password2']) { - PEAR::raiseError('The new passwords do not match.'); + if (!$auth_user->isAdmin()) { + if (empty($_POST['password_old']) + || empty($_POST['password']) + || empty($_POST['password2']) + ) { + PEAR::raiseError('Please fill out all password fields.'); break; } - - $data = array( - 'password' => md5($_POST['password']), - 'handle' => $handle, - ); - - $result = user::update($data); - if ($result) { - $expire = !empty($_POST['PEAR_PERSIST']) ? 2147483647 : 0; - setcookie('PEAR_PW', md5($_POST['password']), $expire, '/'); - report_success('The password was successfully updated.'); + if ($user['password'] != md5($_POST['password_old'])) { + PEAR::raiseError('You provided a wrong old password.'); + break; } - break; - } - /* }}} */ - - if (empty($_POST['password_old']) || empty($_POST['password']) || - empty($_POST['password2']) - ) { - PEAR::raiseError('Please fill out all password fields.'); - break; - } - - if ($user['password'] != md5($_POST['password_old'])) { - PEAR::raiseError('You provided a wrong old password.'); - break; } if ($_POST['password'] != $_POST['password2']) { @@ -205,6 +187,9 @@ ); $result = user::update($data); if ($result) { + // TODO do the SVN push here + + $expire = !empty($_POST['PEAR_PERSIST']) ? 2147483647 : 0; setcookie('PEAR_PW', md5($_POST['password']), $expire, '/'); @@ -271,7 +256,6 @@ 'longitude' => htmlspecialchars($row['longitude']), )); -$form->addElement('html', '<caption class="form-caption">Edit Your Information</caption>'); $form->addElement('checkbox', 'active', 'Active User?'); $form->addElement('text', 'name', '<span class="accesskey">N</span>ame:', 'size="40" accesskey="n"'); $form->addElement('text', 'email', 'Email:', array('size' => 40)); @@ -303,7 +287,7 @@ print '<h2>&raquo; Manage your password</h2>' . "\n"; -$form = new HTML_QuickForm('account-edit-password', 'post', 'account-edit.php', 'test'); +$form = new HTML_QuickForm('account-edit-password', 'post', 'account-edit.php', 'style="padding-top: 20px;"'); $renderer =& $form->defaultRenderer(); $renderer->setElementTemplate(' @@ -329,7 +313,6 @@ </div> </form>'); -$form->addElement('html', '<caption class="form-caption">Change Password</caption>'); $form->addElement('password', 'password_old', '<span class="accesskey">O</span>ld Password:', 'accesskey="0"'); $form->addElement('password', 'password', 'Current Password:'); $form->addElement('password', 'password2', 'Repeat Password:');

« previous php.pear.core (#7585) next »