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
|
// L'utilisateur est déjà connecté
if ($session)
{
Utils::redirect('/admin/');
}
// Relance session_start et renvoie une image de 1px transparente
if (isset($_GET['keepSessionAlive']))
{
Session::refresh();
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-Type: image/gif');
echo base64_decode("R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==");
exit;
}
$errors = [];
$fail = false;
// Soumission du formulaire
if (f('login'))
{
$check = fc('login', [
'_id' => 'required|string',
'passe' => 'required|string',
'permanent' => 'boolean',
], $errors);
if ($check && ($fail = Membres\Session::login(f('_id'), f('passe'), (bool) f('permanent'))))
{
Utils::redirect('/admin/');
}
}
$champs = $config->get('champs_membres');
$champ = $champs->get($config->get('champ_identifiant'));
$tpl->assign('ssl_enabled', empty($_SERVER['HTTPS']) ? false : true);
$tpl->assign('prefer_ssl', (bool)PREFER_HTTPS);
$tpl->assign('own_https_url', str_replace('http://', 'https://', utils::getSelfURL()));
$tpl->assign('champ', $champ);
$tpl->assign('form_errors', $errors);
$tpl->assign('fail', $fail);
$tpl->display('admin/login.tpl');
|
|
<
|
|
|
<
|
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
|
// L'utilisateur est déjà connecté
if ($session)
{
Utils::redirect('/admin/');
}
// Relance session_start et renvoie une image de 1px transparente
if (qg('keepSessionAlive') !== null)
{
Session::refresh();
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-Type: image/gif');
echo base64_decode("R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==");
exit;
}
$fail = false;
// Soumission du formulaire
if (f('login'))
{
$form->check('login', [
'_id' => 'required|string',
'passe' => 'required|string',
'permanent' => 'boolean',
]);
if (!$form->hasErrors() && ($fail = Membres\Session::login(f('_id'), f('passe'), (bool) f('permanent'))))
{
Utils::redirect('/admin/');
}
}
$champs = $config->get('champs_membres');
$champ = $champs->get($config->get('champ_identifiant'));
$tpl->assign('ssl_enabled', empty($_SERVER['HTTPS']) ? false : true);
$tpl->assign('prefer_ssl', (bool)PREFER_HTTPS);
$tpl->assign('own_https_url', str_replace('http://', 'https://', utils::getSelfURL()));
$tpl->assign('champ', $champ);
$tpl->assign('fail', $fail);
$tpl->display('admin/login.tpl');
|