3 * Registration verification page
5 * This page is accessed with the link sent in account confirmation
8 * Copyright 1999-2001 (c) VA Linux Systems
9 * Copyright 2010, Franck Villaume - Capgemini
10 * Copyright 2012, Franck Villaume - TrivialDev
12 * This file is part of FusionForge. FusionForge is free software;
13 * you can redistribute it and/or modify it under the terms of the
14 * GNU General Public License as published by the Free Software
15 * Foundation; either version 2 of the Licence, or (at your option)
18 * FusionForge is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License along
24 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
25 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 require_once('../env.inc.php');
29 require_once $gfcommon.'include/pre.php';
31 $confirm_hash = getStringFromRequest('confirm_hash');
33 if (getStringFromRequest('submit')) {
34 $loginname = getStringFromRequest('loginname');
35 $passwd = getStringFromRequest('passwd');
38 exit_missing_param('',array(_('UserName')),'my');
41 $u = user_get_object_by_name($loginname);
42 if (!$u && forge_get_config('require_unique_email')) {
43 $u = user_get_object_by_email ($loginname);
45 if (!$u || !is_object($u)) {
46 exit_error(_('Could Not Get User'),'home');
47 } elseif ($u->isError()) {
48 exit_error($u->getErrorMessage(),'my');
51 if ($u->getStatus()=='A'){
52 exit_error(_('Account already active.'),'my');
55 $confirm_hash = html_clean_hash_string($confirm_hash);
57 if ($confirm_hash != $u->getConfirmHash()) {
58 exit_error(_('Cannot confirm account identity - invalid confirmation hash (or login name)'),'my');
61 if (!session_login_valid($loginname, $passwd, 1)) {
62 exit_permission_denied(_('Credentials you entered do not correspond to valid account.'),'my');
65 if (!$u->setStatus('A')) {
66 exit_error( _('Error while activiting account').': '.$u->getErrorMessage(),'my');
68 if (forge_get_config('user_notification_on_activation')) {
69 $u->setAdminNotification();
73 session_redirect("/account/first.php");
76 $HTML->header(array('title'=>'Verify'));
78 echo '<p>' . _('In order to complete your registration, login now. Your account will then be activated for normal logins.') . '</p>';
80 if (isset($GLOBALS['error_msg'])) {
81 print '<p class="error">'.$GLOBALS['error_msg'].'</p>';
85 <form action="<?php echo util_make_url('/account/verify.php'); ?>" method="post">
88 if (forge_get_config('require_unique_email')) {
89 echo _('Login name or email address:');
91 echo _('Login name:');
94 <br /><input type="text" name="loginname" /></p>
95 <p><?php echo _('Password')._(':'); ?>
96 <br /><input type="password" name="passwd" /></p>
97 <input type="hidden" name="confirm_hash" value="<?php print htmlentities($confirm_hash); ?>" />
98 <p><input type="submit" name="submit" value="<?php echo _('Login'); ?>" /></p>
102 $HTML->footer(array());