3 * Site Admin user password editing page
6 * Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
9 * Based on other FusionForge code.
11 * This file is part of FusionForge. FusionForge is free software;
12 * you can redistribute it and/or modify it under the terms of the
13 * GNU General Public License as published by the Free Software
14 * Foundation; either version 2 of the License, or (at your option)
17 * FusionForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 require_once '../env.inc.php';
28 require_once $gfwww.'include/pre.php';
29 require_once $gfcommon.'include/account.php';
30 require_once $gfwww.'admin/admin_utils.php';
32 session_require_global_perm ('forge_admin');
34 $user_id = getIntFromRequest('user_id');
35 $u =& user_get_object($user_id);
36 if (!$u || !is_object($u)) {
37 exit_error('Error','Could Not Get User');
38 } elseif ($u->isError()) {
39 exit_error('Error',$u->getErrorMessage());
42 if (getStringFromRequest('submit')) {
43 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
44 exit_form_double_submit();
47 $passwd = getStringFromRequest('passwd');
48 $passwd2 = getStringFromRequest('passwd2');
50 if (strlen($passwd)<6) {
51 form_release_key(getStringFromRequest('form_key'));
54 _('You must supply valid password (at least 6 chars)')
58 if ($passwd != $passwd2) {
59 form_release_key(getStringFromRequest('form_key'));
62 _('New passwords do not match.')
66 if (!$u->setPasswd($passwd)) {
67 form_release_key(getStringFromRequest('form_key'));
70 'Could not change password: '.$u->getErrorMessage()
74 site_admin_header(array('title'=>_('Site Admin: Successfully Changed User Password')));
76 printf(_('<h2>%1$s Password Change Confirmation</h2><p>You have changed the password of %2$s (%3$s).</p>'), forge_get_config('forge_name'), $u->getUnixName(), $u->getRealName());
77 printf('<p>'._("Go back to %s.").'</p>', '<a href="userlist.php">'._("the Full User List").'</a>');
80 site_admin_header(array('title'=>_('Site Admin: Change User Password')));
83 <form action="<?php echo util_make_url('/admin/passedit.php?user_id='.$user_id); ?>" method="post">
84 <input type="hidden" name="form_key" value="<?php echo form_generate_key(); ?>"/>
85 <p><?php printf(_('Changing password for user #%1$s "%2$s" (%3$s)…'), $user_id, $u->getUnixName(), $u->getRealName()); ?></p>
86 <p><?php echo _('New Password (at least 6 chars)') ?>:
87 <br /><input type="password" name="passwd" /></p>
88 <p><?php echo _('New Password (repeat)') ?>:
89 <br /><input type="password" name="passwd2" /></p>
90 <p><input type="submit" name="submit" value="<?php echo _('Update password') ?>" /></p>
95 site_admin_footer(array());