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
11 * This file is part of FusionForge. FusionForge is free software;
12 * you can redistribute it and/or modify it under the terms of the
13 * GNU General Public License as published by the Free Software
14 * Foundation; either version 2 of the Licence, or (at your option)
17 * FusionForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 Header( "Expires: Wed, 11 Nov 1998 11:11:11 GMT");
28 Header( "Cache-Control: no-cache");
29 Header( "Cache-Control: must-revalidate");
31 require_once('../../../www/env.inc.php');
32 require_once $gfcommon.'include/pre.php';
33 require_once('../../../www/include/login-form.php');
35 $plugin = plugin_get_object('authldap');
37 $return_to = getStringFromRequest('return_to');
38 $login = getStringFromRequest('login');
39 $form_loginname = getStringFromRequest('form_loginname');
40 $form_pw = getStringFromRequest('form_pw');
41 $triggered = getIntFromRequest('triggered');
47 $tmpreturn=explode('?',$return_to);
48 $rtpath = $tmpreturn[0] ;
50 if (@is_file(forge_get_config('url_root').$rtpath)
51 || @is_dir(forge_get_config('url_root').$rtpath)
52 || (strpos($rtpath,'/projects') == 0)
53 || (strpos($rtpath,'/plugins/mediawiki') == 0)) {
61 if (forge_get_config('use_ssl') && !session_issecure()) {
62 //force use of SSL for login
63 header('Location: https://'.getStringFromServer('HTTP_HOST').getStringFromServer('REQUEST_URI'));
66 // ###### first check for valid login, if so, redirect
69 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
70 exit_form_double_submit();
72 $test = $plugin->checkLDAPCredentials(strtolower($form_loginname),$form_pw);
73 if ($test == FORGE_AUTH_AUTHORITATIVE_ACCEPT) {
74 if ($plugin->isSufficient()) {
75 $plugin->startSession($form_loginname);
78 header ("Location: " . util_make_url($return_to));
81 header ("Location: " . util_make_url("/my"));
84 } elseif ($test == FORGE_AUTH_AUTHORITATIVE_REJECT) {
85 if ($form_loginname && $form_pw) {
86 $warning_msg = _('Invalid Password Or User Name');
88 $warning_msg = _('Missing Password Or Users Name');
91 $warning_msg = _('LDAP server unreachable');
95 $HTML->header(array('title'=>'Login'));
98 form_release_key(getStringFromRequest('form_key'));
100 if (!isset($userstatus)) {
101 if (isset ($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 } else if ($userstatus == "P") {
109 $warning_msg .= '<br />'. 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)));
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"));
115 html_error_top($error_msg);
116 html_warning_top($warning_msg);
117 html_feedback_top($feedback);
120 // Otherwise, display the login form again
121 display_login_form($return_to, $triggered);
123 $HTML->footer(array());
127 // c-file-style: "bsd"