3 * FusionForge login page
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
10 * Copyright 2011, Roland Mas
11 * Copyright 2011, Franck Villaume - Capgemini
13 * This file is part of FusionForge. FusionForge is free software;
14 * you can redistribute it and/or modify it under the terms of the
15 * GNU General Public License as published by the Free Software
16 * Foundation; either version 2 of the Licence, or (at your option)
19 * FusionForge is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License along
25 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
26 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 Header("Expires: Wed, 11 Nov 1998 11:11:11 GMT");
30 Header("Cache-Control: no-cache");
31 Header("Cache-Control: must-revalidate");
33 require_once '../../../www/env.inc.php';
34 require_once $gfcommon.'include/pre.php';
35 require_once '../../../www/include/login-form.php';
37 /* because session_check_credentials_in_database is setting warning_msg */
40 $plugin = plugin_get_object('authbuiltin');
42 $return_to = getStringFromRequest('return_to');
43 $login = getStringFromRequest('login');
44 $form_loginname = getStringFromRequest('form_loginname');
45 $form_pw = getStringFromRequest('form_pw');
46 $triggered = getIntFromRequest('triggered');
48 if (session_loggedin())
49 session_redirect('/my');
55 $tmpreturn = explode('?',$return_to);
56 $rtpath = $tmpreturn[0] ;
58 if (@is_file(forge_get_config('url_root').$rtpath)
59 || @is_dir(forge_get_config('url_root').$rtpath)
60 || (strpos($rtpath,'/projects') == 0)
61 || (strpos($rtpath,'/plugins/mediawiki') == 0)) {
69 if (forge_get_config('use_ssl') && !session_issecure()) {
70 //force use of SSL for login
71 header('Location: https://'.getStringFromServer('HTTP_HOST').getStringFromServer('REQUEST_URI'));
74 // ###### first check for valid login, if so, redirect
77 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
78 exit_form_double_submit();
80 if (session_check_credentials_in_database(strtolower($form_loginname), $form_pw, false)) {
81 if ($plugin->isSufficient()) {
82 $plugin->startSession($form_loginname);
85 session_redirect($return_to);
88 session_redirect('/my');
92 if ($form_loginname && $form_pw) {
94 $warning_msg = _('Missing Password Or User Name');
98 form_release_key(getStringFromRequest('form_key'));
100 if (!isset($userstatus)) {
101 if (!empty($form_loginname)) {
102 $u = user_get_object_by_name($form_loginname) ||
103 user_get_object_by_email($form_loginname) ;
105 $warning_msg .= '<br /><p>'. _('Your account does not exist.').'</p>';
108 } elseif ($userstatus == "P") {
109 $warning_msg .= '<br />'. sprintf(_('<p>Your account is currently pending your email confirmation.<br/>Visiting the link sent to you in this email will activate your account.<br/>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>'), util_make_url ("/account/pending-resend.php?form_user=".htmlspecialchars($form_loginname)));
111 if ($userstatus == "D") {
112 $error_msg = '<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"));
117 $HTML->header(array('title'=>'Login'));
119 // Otherwise, display the login form again
120 display_login_form($return_to, $triggered);
122 $HTML->footer(array());
126 // c-file-style: "bsd"