forked from unraid/webgui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
35 lines (30 loc) · 1.16 KB
/
login.php
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
<?php
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Helpers.php";
// add translations
extract(parse_plugin_cfg('dynamix',true));
$login_locale = $display['locale'];
require_once "$docroot/webGui/include/Translations.php";
$var = parse_ini_file('state/var.ini');
$error = '';
if ($_SERVER['REQUEST_URI'] == '/logout') {
// User Logout
if (isset($_COOKIE[session_name()])) {
session_start();
unset($_SESSION['unraid_login']);
unset($_SESSION['unraid_user']);
// delete session file
session_destroy();
// delete the session cookie
$params = session_get_cookie_params();
setcookie(session_name(), '', 0, '/', $params['domain'], $params['secure'], isset($params['httponly']));
syslog(LOG_INFO, "Successfull logout user {$_SERVER['USER']} from {$_SERVER['REMOTE_ADDR']}");
}
$error = _('Successfully logged out');
}
$result = exec( "/usr/bin/passwd --status root");
if (($result === false) || (substr($result, 0, 6) !== "root P"))
include "$docroot/webGui/include/set-password.php";
else
include "$docroot/webGui/include/login.php";
?>