mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-04-04 15:13:40 -04:00
Fix logout race condition (#3578)
This commit is contained in:
@@ -5,7 +5,7 @@ function validate_method()
|
||||
|
||||
$url = $_SERVER['REQUEST_URI'];
|
||||
|
||||
$post_required = preg_match('/\/(save|delete*|remove*)\/?\d*?/', $url);
|
||||
$post_required = preg_match('/\/(logout|save|delete*|remove*)\/?\d*?/', $url);
|
||||
|
||||
if($post_required && $_SERVER["REQUEST_METHOD"] != "POST" && empty($_POST))
|
||||
{
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
<div class="navbar-right" style="margin:0">
|
||||
<?php echo anchor('home/change_password/'.$user_info->person_id, $user_info->first_name . ' ' . $user_info->last_name, array('class' => 'modal-dlg', 'data-btn-submit' => $this->lang->line('common_submit'), 'title' => $this->lang->line('employees_change_password'))); ?>
|
||||
<?php echo ' | ' . ($this->input->get('debug') == 'true' ? $this->session->userdata('session_sha1') . ' | ' : ''); ?>
|
||||
<a href="#" onclick="$.post('<?php echo site_url('home/logout'); ?>');"><?php echo $this->lang->line('login_logout');?></a>
|
||||
<a href="javascript:void(0);" id="logout"><?php echo $this->lang->line('login_logout');?></a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-center" style="text-align:center">
|
||||
|
||||
@@ -47,8 +47,23 @@
|
||||
|
||||
return ajax.apply(this, arguments);
|
||||
};
|
||||
|
||||
|
||||
$(document).ajaxComplete(setup_csrf_token);
|
||||
$(document).ready(function(){
|
||||
$("#logout").click(function(event) {
|
||||
event.preventDefault();
|
||||
$.ajax({
|
||||
url: "<?php echo site_url('home/logout'); ?>",
|
||||
data: {
|
||||
"<?php echo $this->security->get_csrf_token_name(); ?>": csrf_token()
|
||||
},
|
||||
success: function() {
|
||||
window.location.href = '<?php echo site_url(); ?>';
|
||||
},
|
||||
method: "POST"
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
var submit = $.fn.submit;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
version: '3.4'
|
||||
version: '3.7'
|
||||
|
||||
volumes:
|
||||
uploads:
|
||||
|
||||
Reference in New Issue
Block a user