3 * Change user's password
5 * Copyright 1999-2001 (c) VA Linux Systems
7 * This file is part of GForge.
9 * GForge is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * GForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with GForge; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 require_once('../env.inc.php');
25 require_once $gfwww.'include/pre.php';
26 require_once $gfcommon.'include/account.php';
28 session_require(array('isloggedin'=>1));
30 $u =& user_get_object(user_getid());
31 if (!$u || !is_object($u)) {
32 exit_error('Error','Could Not Get User');
33 } elseif ($u->isError()) {
34 exit_error('Error',$u->getErrorMessage());
37 if (getStringFromRequest('submit')) {
38 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
39 exit_form_double_submit();
42 $old_passwd = getStringFromRequest('old_passwd');
43 $passwd = getStringFromRequest('passwd');
44 $passwd2 = getStringFromRequest('passwd2');
46 if ($u->getMD5Passwd() != md5($old_passwd)) {
47 form_release_key(getStringFromRequest('form_key'));
50 _('Old password is incorrect')
54 if (strlen($passwd)<6) {
55 form_release_key(getStringFromRequest('form_key'));
58 _('You must supply valid password (at least 6 chars)')
62 if ($passwd != $passwd2) {
63 form_release_key(getStringFromRequest('form_key'));
66 _('New passwords do not match.')
70 if (!$u->setPasswd($passwd)) {
71 form_release_key(getStringFromRequest('form_key'));
74 'Could not change password: '.$u->getErrorMessage()
77 //plugin webcal change user password
79 plugin_hook('change_cal_password',user_getid());
82 site_user_header(array('title'=>_('Successfully Changed Password')));
85 <?php printf(_('<h2>%1$s Password Change Confirmation</h2><p>Congratulations. You have changed your password.</p>'), forge_get_config ('forge_name')); ?>
88 <?php printf(_('You should now <a href="%1$s">Return to User Prefs</a>.'),
89 util_make_url('/account/')) ?>
95 site_user_header(array('title'=>_('Change Password')));
98 <form action="<?php echo util_make_url('/account/change_pw.php'); ?>" method="post">
99 <input type="hidden" name="form_key" value="<?php echo form_generate_key(); ?>"/>
100 <p><?php echo _('Old Password') ?>:
101 <br /><input type="password" name="old_passwd" /></p>
102 <p><?php echo _('New Password (at least 6 chars)') ?>:
103 <br /><input type="password" name="passwd" /></p>
104 <p><?php echo _('New Password (repeat)') ?>:
105 <br /><input type="password" name="passwd2" /></p>
106 <p><input type="submit" name="submit" value="<?php echo _('Update password') ?>" /></p>
111 site_user_footer(array());