1
0
mirror of https://github.com/Mowie/Mowie synced 2024-06-03 09:29:38 +00:00

Fixed user is only every 10 minitues asked for his password

This commit is contained in:
kolaente 2017-10-04 18:14:41 +02:00
parent 2398fa28c0
commit 81530d956b
2 changed files with 57 additions and 26 deletions

View File

@ -92,6 +92,7 @@ if(isset($_GET['checkPassword']))
if (password_verify($_POST['pw'], $db->data[0]['pass']))
{
echo 'success';
$_SESSION['sudomode'] = time();
}
else
{
@ -109,3 +110,23 @@ if(isset($_GET['checkPassword']))
echo 'login first.';
}
}
// Check if the user already entered his password
if (isset($_GET['checkSudo']))
{
if(is_loggedin())
{
// Check if the user entered his password less then 10 minutes ago
if (isset($_SESSION['sudomode']) && $_SESSION['sudomode'] >= (time() - 600))
{
echo 'true';
} else
{
echo 'false';
}
}
else
{
echo 'login first.';
}
}

View File

@ -141,6 +141,9 @@ if (!isset($_GET['direct']))
//Confirm user password
if (needsPwConfirm) {
// check if the user already entered his password
$.get('login.php?checkSudo', function( data ) {
if (data == 'false'){
$('#showMsg').html('<div class="overlay" style="display:none;"><div class="window-confirm"><div class="head"><?php echo $lang->get('legitimate_title')?><a onclick="closeW();" class="closeMsg"><i class="fa fa-close"></i></a></div><div id="content"></div></div></div>');
$('#content').append('<p><?php echo $lang->get('legitimate_text')?></p><p><input type="password" placeholder="<?php echo $lang->get('password')?>" id="password_legitimate" autofocus/><input type="submit" value="<?php echo $lang->get('legitimate_confirm')?>" id="legitimateSmbt"/><a onclick="closeW();" class="button btn_del"><?php echo $lang->get('legitimate_abort')?></a></p><span id="sendMsg"></span>');
$('#password_legitimate').focus();
@ -172,6 +175,13 @@ if (!isset($_GET['direct']))
}
});
});
} else {
//Send the request
if (!isAjax) {
sendPost(ctx, requestData);
}
}
});
} else {
if (!isAjax) {
sendPost(ctx, requestData);