5 * This is main login page. It takes care of different account states
6 * (by disallowing logging in with non-active account, with appropriate
9 * Copyright 1999-2001 (c) VA Linux Systems
11 * This file is part of GForge.
13 * GForge is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * GForge 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
24 * along with GForge; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 Header( "Expires: Wed, 11 Nov 1998 11:11:11 GMT");
29 Header( "Cache-Control: no-cache");
30 Header( "Cache-Control: must-revalidate");
32 require_once('../env.inc.php');
33 require_once $gfwww.'include/pre.php';
35 $return_to = getStringFromRequest('return_to');
36 $login = getStringFromRequest('login');
37 $form_loginname = getStringFromRequest('form_loginname');
38 $form_pw = getStringFromRequest('form_pw');
39 $feedback = getStringFromRequest('feedback');
45 $tmpreturn=explode('?',$return_to);
46 if (!@is_file($sys_urlroot.$tmpreturn[0]) && !@is_dir($sys_urlroot.$tmpreturn[0]) && !(strpos($tmpreturn[0],'projects') == 1) && !(strpos($tmpreturn[0],'mediawiki') == 1)) {
51 if (forge_get_config('use_ssl') && !session_issecure()) {
52 //force use of SSL for login
53 header('Location: https://'.getStringFromServer('HTTP_HOST').getStringFromServer('REQUEST_URI'));
56 // Decide login button based on session.
57 if (session_issecure()) {
58 $login_button = _('Login with SSL');
60 $login_button = _('Login');
63 // ###### first check for valid login, if so, redirect
66 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
67 exit_form_double_submit();
69 $success=session_login_valid(strtolower($form_loginname),$form_pw);
72 You can now optionally stay in SSL mode
75 header ("Location: " . $return_to);
78 header ("Location: ".util_make_url ("/my/"));
84 if (isset($session_hash)) {
85 //nuke their old session
89 //echo "\n\n$session_hash";
90 //echo "\n\nlogged in: ".session_loggedin();
92 $HTML->header(array('title'=>'Login'));
94 if ($login && !$success) {
95 form_release_key(getStringFromRequest('form_key'));
97 if (!isset($userstatus)) {
98 if (isset ($form_loginname)) {
99 $u = user_get_object_by_name($form_loginname) ||
100 user_get_object_by_email($form_loginname) ;
102 $feedback = _('<p>Your account does not exist.</p>');
105 } else if ($userstatus == "P") {
106 $feedback = sprintf(_('<p>Your account is currently pending your email confirmation. Visiting the link sent to you in this email will activate your account. <p>If you need this email resent, please click below and a confirmation email will be sent to the email address you provided in registration. <p><a href="%1$s">[Resend Confirmation Email]</a> <br><hr> <p>'), util_make_url ("/account/pending-resend.php?form_user=".htmlspecialchars($form_loginname)));
108 if ($userstatus == "D") {
109 $feedback .= '<br />'.sprintf(_('<p>Your %1$s account has been removed by %1$s staff. This may occur for two reasons, either 1) you requested that your account be removed; or 2) some action has been performed using your account which has been seen as objectionable (i.e. you have breached the terms of service for use of your account) and your account has been revoked for administrative reasons. Should you have questions or concerns regarding this matter, please log a <a href="%2$s">support request</a>.</p><p>Thank you, <br><br>%1$s Staff</p>'), forge_get_config ('forge_name'), util_make_url ("/support/?group_id=1"));
112 html_feedback_top($feedback);
118 <span class="error"><?php echo _('Cookies must be enabled past this point.'); ?></span>
120 <form action="<?php echo util_make_url('/account/login.php'); ?>" method="post">
121 <input type="hidden" name="form_key" value="<?php echo form_generate_key(); ?>"/>
122 <input type="hidden" name="return_to" value="<?php echo htmlspecialchars(stripslashes($return_to)); ?>" />
124 <?php if (forge_get_config('require_unique_email')) {
125 echo _('Login name or email address');
127 echo _('Login name:');
129 <br /><input type="text" name="form_loginname" value="<?php echo htmlspecialchars(stripslashes($form_loginname)); ?>" />
132 <?php echo _('Password:'); ?>
133 <br /><input type="password" name="form_pw" />
136 <input type="submit" name="login" value="<?php echo $login_button; ?>" />
139 <p><a href="lostpw.php"><?php echo _('[Lost your password?]'); ?></a></p>
141 // hide "new account" item if restricted to admin
142 if (!forge_get_config ('user_registration_restricted')) {
143 echo '<p><a href="register.php">'._('[New Account]').'</a></p>';
146 <p><a href="pending-resend.php"><?php echo _('[Resend confirmation email to a pending account]'); ?></a></p>
150 $HTML->footer(array());
154 // c-file-style: "bsd"