Added cookie test of login page

This commit is contained in:
DL6ER
2017-01-16 15:45:44 +01:00
parent 2f334430e1
commit 09f5bfdea8
2 changed files with 22 additions and 1 deletions
+21
View File
@@ -204,3 +204,24 @@ $(document).keypress(function(e) {
$("#loginform").submit(); $("#loginform").submit();
} }
}); });
function testCookies()
{
if (navigator.cookieEnabled) return true;
// set and read cookie
document.cookie = "cookietest=1";
var ret = document.cookie.indexOf("cookietest=") != -1;
// delete cookie
document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
return ret;
}
$(function() {
if(!testCookies() && $("#cookieInfo").length)
{
$("#cookieInfo").show();
}
});
+1 -1
View File
@@ -5,6 +5,7 @@
<div class="panel-title text-center"><span class="logo-lg" style="font-size: 25px;"><b>Pi</b>-hole</span></div> <div class="panel-title text-center"><span class="logo-lg" style="font-size: 25px;"><b>Pi</b>-hole</span></div>
<p class="login-box-msg">Sign in to start your session</p> <p class="login-box-msg">Sign in to start your session</p>
<div id="cookieInfo" class="panel-title text-center" style="color:#F00; font-size: 150%" hidden>Verify that cookies are allowed for <tt><?php echo $_SERVER['HTTP_HOST']; ?></tt></div>
<?php if ($wrongpassword) { ?> <?php if ($wrongpassword) { ?>
<div class="form-group has-error login-box-msg"> <div class="form-group has-error login-box-msg">
<label class="control-label"><i class="fa fa-times-circle-o"></i> Wrong password!</label> <label class="control-label"><i class="fa fa-times-circle-o"></i> Wrong password!</label>
@@ -54,7 +55,6 @@
</div> </div>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</div> </div>