3 * Change user's email page
5 * Copyright 1999-2001 (c) VA Linux Systems
9 * This file is part of GForge.
11 * GForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * GForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with GForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 require_once('../env.inc.php');
27 require_once $gfwww.'include/pre.php';
29 session_require(array('isloggedin'=>1));
32 if (getStringFromRequest('submit')) {
33 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
34 exit_form_double_submit();
37 $newemail = getStringFromRequest('newemail');
39 if (!validate_email($newemail)) {
40 form_release_key(getStringFromRequest('form_key'));
41 exit_error(_('Error'),_('Invalid email address.'));
44 $confirm_hash = substr(md5($session_hash . time()),0,16);
46 $u =& user_get_object(user_getid());
47 if (!$u || !is_object($u)) {
48 form_release_key(getStringFromRequest('form_key'));
49 exit_error('Error','Could Not Get User');
50 } elseif ($u->isError()) {
51 form_release_key(getStringFromRequest('form_key'));
52 exit_error('Error',$u->getErrorMessage());
55 if (!$u->setNewEmailAndHash($newemail, $confirm_hash)) {
56 form_release_key(getStringFromRequest('form_key'));
58 'Could Not Complete Operation',
63 $message = stripcslashes(sprintf(_('You have requested a change of email address on %1$s.
64 Please visit the following URL to complete the email change:
70 util_make_url ('/account/change_email-complete.php?ch=_'.$confirm_hash), ));
72 util_send_message($newemail,sprintf(_('%1$s Verification'), $GLOBALS['sys_name']),$message);
74 site_user_header(array('title'=>_('Email Change Confirmation')));
76 printf (_('<p>An email has been sent to the new address. Follow the instructions in the email to complete the email change. </p><a href="%1$s">[ Home ]</a>'), util_make_url ('/'));
78 site_user_footer(array());
83 site_user_header(array('title'=>_('Email change')));
85 echo _('<p>Changing your email address will require confirmation from your new email address, so that we can ensure we have a good email address on file.</p><p>We need to maintain an accurate email address for each user due to the level of access we grant via this account. If we need to reach a user for issues arriving from a shell or project account, it is important that we be able to do so.</p> <p>Submitting the form below will mail a confirmation URL to the new email address. Visiting this link will complete the email change.</p>');
88 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="post">
89 <input type="hidden" name="form_key" value="<?php echo form_generate_key(); ?>"/>
90 <?php echo _('New Email Address:') ?>
91 <input type="text" name="newemail" maxlength="255" />
92 <input type="submit" name="submit" value="<?php echo _('Send Confirmation to New Address') ?>" />
95 <p><?php echo util_make_link('/', _('Return')); ?></p>
98 site_user_footer(array());
102 // c-file-style: "bsd"