GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — projectsend/index.php at develop · linuxliste/projectsend

Expand file tree

/

index.php

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
183 lines (160 loc) · 7.2 KB
/

index.php

Copy path

File metadata and controls

183 lines (160 loc) · 7.2 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<?php
/**
* ProjectSend (previously cFTP) is a free, clients-oriented, private file
* sharing web application.
* Clients are created and assigned a username and a password. Then you can
* upload as much files as you want under each account, and optionally add
* a name and description to them.
*
* ProjectSend is hosted on Google Code.
* Feel free to participate!
*
* @link https://github.com/projectsend/projectsend
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL version 2
* @package ProjectSend
*/
require_once 'bootstrap.php';
global $dbh;
global $auth;
global $flash;
global $bfchecker;
$page_title = __('Log in', 'cftp_admin');
$body_class = array('login');
$page_id = 'login';
$current_ip = get_client_ip();
$bfstatus = $bfchecker->getLoginStatus(get_client_ip());
switch ($bfstatus['status']) {
case 'error_403':
$flash->clear(); // @todo hack, since flash messages after the last error should not be retained
exit_with_error_code(403);
break;
}
if ($_POST) {
switch ($_POST['do']) {
default:
exit_with_error_code(403);
break;
case 'login':
recaptcha2_validate_request();
$remember_me = !empty($_POST['remember_me']) && $_POST['remember_me'] === '1';
$login = json_decode($auth->authenticate($_POST['username'], $_POST['password'], $remember_me));
if ($login->status == 'success') {
$user = new \ProjectSend\Classes\Users($login->user_id);
ps_redirect($login->location);
} else {
$flash->error($auth->getError());
switch ($bfstatus['status']) {
case 'delay':
if (is_numeric($bfstatus['message'])) {
$flash->error('<div id="message_countdown">' . sprintf(__('Please wait %s seconds before attempting to log in again.', 'cftp_admin'), '<span class="seconds_countdown">' . $bfstatus['message'] . '</span>') . '</div>');
if ($bfstatus['message'] > 150) {
$flash->error(sprintf(__('Warning: You are about to reach the failed attempts limit, which will completely block your access for a few minutes.', 'cftp_admin'), $bfstatus['message']));
}
}
break;
}
ps_redirect(BASE_URI);
}
// $auth->setLanguage($_POST['language']);
break;
case 'login_ldap':
recaptcha2_validate_request();
$remember_me = !empty($_POST['remember_me']) && $_POST['remember_me'] === '1';
$login = json_decode($auth->loginLdap($_POST['ldap_email'], $_POST['ldap_password'], $_POST['language'] ?? null, $remember_me));
if ($login->status == 'success') {
$user = new \ProjectSend\Classes\Users($login->user_id);
ps_redirect($login->location);
} else {
$flash->error($auth->getError());
ps_redirect(BASE_URI);
}
break;
case '2fa_verify':
recaptcha2_validate_request();
$code = $_POST['n1'] . $_POST['n2'] . $_POST['n3'] . $_POST['n4'] . $_POST['n5'] . $_POST['n6'];
$login = json_decode($auth->validate2faRequest($_POST['token'], (int)$code));
if ($login->status == 'success') {
$user = new \ProjectSend\Classes\Users($login->user_id);
ps_redirect($login->location);
} else {
$flash->error($auth->getError());
ps_redirect(BASE_URI . "index.php?form=2fa_verify&token=" . $_POST['token']);
}
break;
case '2fa_request_another':
recaptcha2_validate_request();
$auth_code = new \ProjectSend\Classes\AuthenticationCode();
if (!$auth_code->getByToken($_POST['token'])) {
exit_with_error_code(403);
}
$props = $auth_code->getProperties();
if ($auth_code->canRequestNewCode($props['user_id'])) {
$request = json_decode($auth_code->requestNewCode($props['user_id']));
if ($request->status == 'success') {
ps_redirect(BASE_URI . "index.php?form=2fa_verify&token=" . $request->token);
}
ps_redirect(BASE_URI);
}
break;
}
}
$csrf_token = getCsrfToken();
$login_types = array(
'local' => '1',
'ldap' => get_option('ldap_signin_enabled'),
);
$valid_forms = ['login', '2fa_verify'];
$form = (isset($_GET['form']) && in_array($_GET['form'], $valid_forms)) ? $_GET['form'] : 'login';
if ($form == '2fa_verify') {
$request = new \ProjectSend\Classes\AuthenticationCode();
$get_request = $request->getByToken($_GET['token']);
if ($get_request == false) {
exit_with_error_code(403);
}
$props = $request->getProperties();
$user = get_user_by_id($props['user_id']);
$masked_email = mask_email($user['email']);
}
include_once ADMIN_VIEWS_DIR . DS . 'header-unlogged.php';
?>
<div class="row justify-content-md-center">
<div class="col-12 col-sm-12 col-lg-4">
<div class="ps-card">
<div class="ps-card-body">
<div class="ajax_response">
</div>
<?php if ($login_types['ldap'] == 'true') { ?>
<!-- Tab Navigation -->
<div class="login-tabs-container mb-4">
<ul class="nav nav-pills nav-fill login-pills" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="local-tab" data-bs-toggle="tab" data-bs-target="#local" type="button" role="tab" aria-controls="local" aria-selected="true">
<i class="fa fa-user me-2"></i><?php _e('Local Account', 'cftp_admin'); ?>
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="ldap-tab" data-bs-toggle="tab" data-bs-target="#ldap" type="button" role="tab" aria-controls="ldap" aria-selected="false">
<i class="fa fa-server me-2"></i><?php _e('LDAP/Active Directory', 'cftp_admin'); ?>
</button>
</li>
</ul>
</div>
<?php } ?>
<div class="tab-content<?php if ($login_types['ldap'] != true) { echo ' mt-0'; } ?>">
<div role="tabpanel" class="tab-pane fade active show" id="local">
<?php
include_once FORMS_DIR . DS . $form . '.php';
?>
</div>
<?php if ($login_types['ldap'] == 'true') { ?>
<div role="tabpanel" class="tab-pane fade" id="ldap">
<?php include_once FORMS_DIR . DS . 'login-ldap.php'; ?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<?php
include_once ADMIN_VIEWS_DIR . DS . 'footer.php';
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.