3 * Commit user's email change
5 * This page should be accessed with confirmation URL sent to user in email
7 * Copyright 1999-2001 (c) VA Linux Systems
8 * Copyright 2010 (c) Franck Villaume
10 * This file is part of FusionForge. FusionForge is free software;
11 * you can redistribute it and/or modify it under the terms of the
12 * GNU General Public License as published by the Free Software
13 * Foundation; either version 2 of the Licence, or (at your option)
16 * FusionForge 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 along
22 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 require_once('../env.inc.php');
27 require_once $gfcommon.'include/pre.php';
28 require_once $gfcommon.'include/account.php';
30 $confirm_hash = getStringFromRequest('confirm_hash');
33 $confirm_hash = getStringFromRequest('ch');
36 exit_missing_param('',array(_('Confirm Hash')),'my');
39 $confirm_hash = html_clean_hash_string($confirm_hash);
41 $res_user = db_query_params ('SELECT * FROM users WHERE confirm_hash=$1',
42 array($confirm_hash)) ;
44 if (db_numrows($res_user) > 1) {
45 exit_error(_('This confirm hash exists more than once.'),'my');
47 if (db_numrows($res_user) < 1) {
48 exit_error(_('Invalid confirmation hash.'),'my');
50 $u =& user_get_object(db_result($res_user, 0, 'user_id'), $res_user);
51 if (!$u || !is_object($u)) {
52 exit_error(_('Could Not Get User'),'home');
53 } elseif ($u->isError()) {
54 exit_error($u->getErrorMessage(),'my');
57 if (!$u->setEmail($u->getNewEmail())) {
58 exit_error($u->getErrorMessage(),'my');
60 //plugin webcal change user mail
62 plugin_hook('change_cal_mail',user_getid());
65 site_user_header(array('title'=>_('Email Change Complete')));
70 printf (_('Welcome, %1$s. Your email change is complete. Your new email address on file is <strong>%2$s</strong>. Mail sent to <%3$s> will now be forwarded to this account.'),$u->getUnixName(),$u->getEmail(),$u->getUnixName().'@'.forge_get_config('users_host')) ?>
73 <p><?php echo util_make_link ('/',_('Return')); ?></p>
77 site_user_footer(array());
81 // c-file-style: "bsd"