Changeset 497 for trunk/services/password.php
- Timestamp:
- Sep 15, 2014 9:44:27 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/services/password.php
r468 r497 4 4 * For details visit the project site: <http://trac.strangecode.com/codebase/> 5 5 * Copyright 2001-2012 Strangecode, LLC 6 * 6 * 7 7 * This file is part of The Strangecode Codebase. 8 8 * … … 11 11 * Free Software Foundation, either version 3 of the License, or (at your option) 12 12 * any later version. 13 * 13 * 14 14 * The Strangecode Codebase is distributed in the hope that it will be useful, but 15 15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16 16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 17 17 * details. 18 * 18 * 19 19 * You should have received a copy of the GNU General Public License along with 20 20 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>. … … 25 25 */ 26 26 27 // require_once dirname(__FILE__) . '/_config.inc.php'; 27 // Redefine include_path including the codebase/services but allow local templates override global ones. 28 ini_set('include_path', join(PATH_SEPARATOR, array( 29 get_include_path(), 30 dirname(__FILE__) . '/templates' 31 ))); 28 32 29 33 $auth->requireLogin(); 30 34 31 35 require_once 'codebase/lib/FormValidator.inc.php'; 36 require_once 'codebase/lib/HTML.inc.php'; 32 37 33 38 /****************************************************************************** … … 36 41 37 42 // Titles and navigation header. 38 $nav->add( _("Change password"));43 $nav->add(sprintf(_("Change password for <em>%s</em>"), $auth->get('username'))); 39 44 40 45 // The object to validate form input from the user. … … 58 63 59 64 // Validate the posted data. 60 // $fv->isEmpty('oldpassword', _("You did not specify the <strong>old password</strong>.")); 61 $fv->checkRegex('oldpassword', '/^[[:alnum:][:punct:]]{0,128}$/i', true, _("The <strong>Old password</strong> specified is not valid.")); 62 if (!$fv->isEmpty('newpassword', _("You did not specify the <strong>New password</strong>."))) { 63 $fv->checkRegex('newpassword', '/^[[:alnum:][:punct:]]{6,128}$/i', true, _("The <strong>New password</strong> specified is not valid. A password must be 6 or more characters.")); 64 if ($frm['newpassword'] != $frm['newpassword2'] && !$fv->isEmpty('newpassword2', _("You need to type the <strong>New password</strong> twice."))) { 65 $fv->addError('newpassword', _("The <strong>New passwords</strong> do not match.")); 66 $fv->addError('newpassword2'); 65 if ($fv->notEmpty('oldpassword', _("You did not specify the <strong>old password</strong>."))) { 66 $fv->checkRegex('oldpassword', '/^\S{0,128}$/i', true, _("The <strong>old password</strong> specified is not valid.")); 67 } 68 if ($fv->notEmpty('newpassword', _("You did not specify the <strong>new password</strong>."))) { 69 if ($fv->checkRegex('newpassword', '/^\S{8,128}$/i', true, _("The <strong>new password</strong> specified is not valid. A password must be eight or more characters."))) { 70 if ($fv->notEmpty('newpassword2', _("You need to type the <strong>new password</strong> twice.")) && $frm['newpassword'] != $frm['newpassword2']) { 71 $fv->addError('newpassword', _("The <strong>new passwords</strong> do not match.")); 72 $fv->addError('newpassword2'); 73 } 67 74 } 68 75 } 69 76 70 77 if (!$fv->anyErrors() && false === $auth->authenticate($auth->get('username'), $frm['oldpassword'])) { 71 $fv->addError('oldpassword', _("Your <strong> Old password</strong> failed authentication."));78 $fv->addError('oldpassword', _("Your <strong>old password</strong> failed authentication.")); 72 79 $app->logMsg(sprintf('Password change failed for %s, using (md5ed) password: %s', $auth->get('username'), md5($frm['oldpassword'])), LOG_NOTICE, __FILE__, __LINE__); 73 80 } … … 84 91 // Templates. 85 92 include 'header.ihtml'; 86 include ' codebase/services/templates/password.ihtml';93 include 'password.ihtml'; 87 94 include 'footer.ihtml'; 88 95
Note: See TracChangeset
for help on using the changeset viewer.