3 * Change user's email page
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';
27 session_require(array('isloggedin'=>1));
30 if (getStringFromRequest('submit')) {
31 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
32 exit_form_double_submit();
35 $newemail = getStringFromRequest('newemail');
37 if (!validate_email($newemail)) {
38 form_release_key(getStringFromRequest('form_key'));
39 exit_error(_('Error'),_('Invalid email address.'));
42 $confirm_hash = substr(md5($GLOBALS['session_ser'] . time()),0,16);
44 $u =& user_get_object(user_getid());
45 if (!$u || !is_object($u)) {
46 form_release_key(getStringFromRequest('form_key'));
47 exit_error('Error','Could Not Get User');
48 } elseif ($u->isError()) {
49 form_release_key(getStringFromRequest('form_key'));
50 exit_error('Error',$u->getErrorMessage());
53 if (!$u->setNewEmailAndHash($newemail, $confirm_hash)) {
54 form_release_key(getStringFromRequest('form_key'));
56 'Could Not Complete Operation',
61 $message = sprintf(_('You have requested a change of email address on %1$s.
62 Please visit the following URL to complete the email change:
67 forge_get_config ('forge_name'),
68 util_make_url ('/account/change_email-complete.php?ch=_'.$confirm_hash));
70 util_send_message($newemail,sprintf(_('%1$s Verification'), forge_get_config ('forge_name')),$message);
72 site_user_header(array('title'=>_('Email Change Confirmation')));
74 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 ('/'));
76 site_user_footer(array());
81 site_user_header(array('title'=>_('Email change')));
83 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>');
86 <form action="<?php echo util_make_url('/account/change_email.php'); ?>" method="post">
87 <input type="hidden" name="form_key" value="<?php echo form_generate_key(); ?>"/>
88 <?php echo _('New Email Address:') ?>
89 <input type="text" name="newemail" maxlength="255" />
90 <input type="submit" name="submit" value="<?php echo _('Send Confirmation to New Address') ?>" />
93 <p><?php echo util_make_link('/', _('Return')); ?></p>
96 site_user_footer(array());
100 // c-file-style: "bsd"