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
12 * Copyright 2015, Franck Villaume - TrivialDev
14 * This file is part of FusionForge. FusionForge is free software;
15 * you can redistribute it and/or modify it under the terms of the
16 * GNU General Public License as published by the Free Software
17 * Foundation; either version 2 of the Licence, or (at your option)
20 * FusionForge is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License along
26 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
27 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 header("Expires: Wed, 11 Nov 1998 11:11:11 GMT");
31 header("Cache-Control: no-cache");
32 header("Cache-Control: must-revalidate");
34 require_once '../../../www/env.inc.php';
35 require_once $gfcommon.'include/pre.php';
36 require_once '../../../www/include/login-form.php';
38 /* because session_check_credentials_in_database is setting warning_msg */
41 $plugin = plugin_get_object('authbuiltin');
43 $return_to = getStringFromRequest('return_to');
44 $login = getStringFromRequest('login');
45 $form_loginname = getStringFromRequest('form_loginname');
46 $form_pw = getStringFromRequest('form_pw');
47 $triggered = getIntFromRequest('triggered');
48 $attempts = getIntFromRequest('attempts');
49 $previous_login = getStringFromRequest('previous_login');
51 if (session_loggedin())
52 session_redirect('/my');
58 $tmpreturn = explode('?',$return_to);
59 $rtpath = $tmpreturn[0] ;
61 if (@is_file(forge_get_config('url_root').$rtpath)
62 || @is_dir(forge_get_config('url_root').$rtpath)
63 || (strpos($rtpath,'/projects') == 0)
64 || (strpos($rtpath,'/plugins/mediawiki') == 0)) {
72 if (forge_get_config('use_ssl') && !session_issecure()) {
73 //force use of SSL for login
74 header('Location: https://'.getStringFromServer('HTTP_HOST').getStringFromServer('REQUEST_URI'));
77 // ###### first check for valid login, if so, redirect
80 if (!form_key_is_valid(getStringFromRequest('form_key'))) {
81 exit_form_double_submit();
86 $params['valide'] =& $valide;
87 plugin_hook('captcha_check', $params);
89 if (session_check_credentials_in_database(strtolower($form_loginname), $form_pw, false) && $valide) {
90 if ($plugin->isSufficient()) {
91 $plugin->startSession($form_loginname);
94 session_redirect($return_to);
96 session_redirect('/my');
99 if ($form_loginname && $form_pw) {
100 $warning_msg = _('Invalid Password Or User Name');
102 $warning_msg = _('Missing Password Or User Name');
106 form_release_key(getStringFromRequest('form_key'));
108 if (!isset($userstatus)) {
109 if (!empty($form_loginname)) {
110 $u = user_get_object_by_name($form_loginname) ||
111 user_get_object_by_email($form_loginname) ;
113 $warning_msg .= '<br />'. _('Your account does not exist.');
116 } elseif ($userstatus == "P") {
117 $warning_msg .= '<br />' . _('Your account is currently pending your email confirmation.')
118 . '<br/>' . _('Visiting the link sent to you in this email will activate your account.')
119 . '<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.')
120 . '<br/>' . sprintf('<a href="%1$s">%2$s</a>',
121 util_make_url("/account/pending-resend.php?form_user=".htmlspecialchars($form_loginname)),
122 _('Resend Confirmation Email'));
123 } elseif ($userstatus == "D") {
124 $error_msg = '<br />' . sprintf(_('Your %1$s account has been removed by %1$s staff.'), forge_get_config('forge_name'))
125 . '<br/>' . _('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.')
126 . '<br/>' . sprintf(_('Should you have questions or concerns regarding this matter, please log a <a href="%s">support request</a>.'), util_make_url("/support/?group_id=1"))
127 . '<br/>' . _('Thank you')
129 . '<br/>' . sprintf(_('-- the %s staff'), forge_get_config('forge_name'));
133 $HTML->header(array('title'=>'Login'));
135 // Otherwise, display the login form again
136 if ($previous_login == $form_loginname) {
141 display_login_form($return_to, $triggered, false, $attempts, $form_loginname);
147 // c-file-style: "bsd"