mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
@leiweibau consolidation-2022-08-06
This commit is contained in:
@@ -3,10 +3,16 @@ session_start();
|
||||
|
||||
if ($_REQUEST['action'] == 'logout') {
|
||||
session_destroy();
|
||||
setcookie("PiAler_SaveLogin", "", time() - 3600);
|
||||
header('Location: index.php');
|
||||
}
|
||||
// ##################################################
|
||||
// ## Login Processing start
|
||||
// ##################################################
|
||||
$config_file = "../config/pialert.conf";
|
||||
$config_file_lines = file($config_file);
|
||||
// ###################################
|
||||
// ## Login settings locale start
|
||||
// ## Login language settings
|
||||
// ###################################
|
||||
if (file_exists('../db/setting_darkmode')) {
|
||||
$ENABLED_DARKMODE = True;
|
||||
@@ -21,14 +27,7 @@ if ($_REQUEST['action'] == 'logout') {
|
||||
}
|
||||
if (strlen($pia_lang_selected) == 0) {$pia_lang_selected = 'en_us';}
|
||||
require 'php/templates/language/'.$pia_lang_selected.'.php';
|
||||
// ###################################
|
||||
// ## Login settings locale end
|
||||
// ###################################
|
||||
// ##################################################
|
||||
// ## Login Processing start
|
||||
// ##################################################
|
||||
$config_file = "../config/pialert.conf";
|
||||
$config_file_lines = file($config_file);
|
||||
|
||||
|
||||
// ###################################
|
||||
// ## PIALERT_WEB_PROTECTION FALSE
|
||||
@@ -38,7 +37,7 @@ $config_file_lines_bypass = array_values(preg_grep('/^PIALERT_WEB_PROTECTION\s.*
|
||||
$protection_line = explode("=", $config_file_lines_bypass[0]);
|
||||
$Pia_WebProtection = strtolower(trim($protection_line[1]));
|
||||
|
||||
if ($Pia_WebProtection == 'false')
|
||||
if ($Pia_WebProtection != 'true')
|
||||
{
|
||||
header('Location: devices.php');
|
||||
$_SESSION["login"] = 1;
|
||||
@@ -57,24 +56,30 @@ if ($Pia_Password == hash('sha256',$_POST["loginpassword"]))
|
||||
{
|
||||
header('Location: devices.php');
|
||||
$_SESSION["login"] = 1;
|
||||
if (isset($_POST['PWRemember'])) {setcookie("PiAler_SaveLogin", hash('sha256',$_POST["loginpassword"]), time()+604800);}
|
||||
}
|
||||
|
||||
if ($_SESSION["login"] == 1)
|
||||
// active Session or valid cookie (cookie not extends)
|
||||
if (($_SESSION["login"] == 1) || ($Pia_Password == $_COOKIE["PiAler_SaveLogin"]))
|
||||
{
|
||||
header('Location: devices.php');
|
||||
$_SESSION["login"] = 1;
|
||||
}
|
||||
|
||||
// no active session, cookie not checked
|
||||
if ($_SESSION["login"] != 1)
|
||||
{
|
||||
if (file_exists('../db/setting_darkmode')) {$ENABLED_DARKMODE = True;}
|
||||
if ($Pia_Password == '8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92') {
|
||||
$login_info = 'Defaultpassword "123456" is still active';
|
||||
$login_mode = 'danger';
|
||||
$login_headline = 'Password Alert!';
|
||||
$login_display_mode = 'display: block;';
|
||||
$login_headline = $pia_lang['Login_Toggle_Alert_headline'];
|
||||
$login_icon = 'fa-ban';
|
||||
} else {
|
||||
$login_mode = 'info';
|
||||
$login_headline = 'Password Information';
|
||||
$login_display_mode = 'display: none;';
|
||||
$login_headline = $pia_lang['Login_Toggle_Info_headline'];
|
||||
$login_icon = 'fa-info';
|
||||
}
|
||||
|
||||
@@ -132,22 +137,31 @@ if ($ENABLED_DARKMODE === True) {
|
||||
<div class="col-xs-8">
|
||||
<div class="checkbox icheck">
|
||||
<label>
|
||||
<input type="checkbox" disabled> <?php echo $pia_lang['Login_Remember'];?>
|
||||
<input type="checkbox" name="PWRemember">
|
||||
<div style="margin-left: 10px; display: inline-block; vertical-align: top;">
|
||||
<?php echo $pia_lang['Login_Remember'];?><br><span style="font-size: smaller"><?php echo $pia_lang['Login_Remember_small'];?></span>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
<div class="col-xs-4">
|
||||
<div class="col-xs-4" style="padding-top: 10px;">
|
||||
<button type="submit" class="btn btn-primary btn-block btn-flat"><?php echo $pia_lang['Login_Submit'];?></button>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div style="padding-top: 10px;">
|
||||
<button class="btn btn-xs btn-primary btn-block btn-flat" onclick="Passwordhinfo()"><?php echo $pia_lang['Login_Toggle_Info'];?></button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!-- /.login-box-body -->
|
||||
|
||||
<div class="box-body" style="margin-top: 50px;">
|
||||
|
||||
|
||||
<div id="myDIV" class="box-body" style="margin-top: 50px; <?php echo $login_display_mode;?>">
|
||||
<div class="alert alert-<?php echo $login_mode;?> alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
||||
<h4><i class="icon fa <?php echo $login_icon;?>"></i><?php echo $login_headline;?></h4>
|
||||
@@ -175,6 +189,16 @@ if ($ENABLED_DARKMODE === True) {
|
||||
increaseArea: '20%' /* optional */
|
||||
});
|
||||
});
|
||||
|
||||
function Passwordhinfo() {
|
||||
var x = document.getElementById("myDIV");
|
||||
if (x.style.display === "none") {
|
||||
x.style.display = "block";
|
||||
} else {
|
||||
x.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user