fix login/logout paths, reload page instead fancy css because the csrf token gets renewed after every login/logout
This commit is contained in:
parent
fb2a1cd4b6
commit
39b3519266
@ -238,13 +238,15 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function login(args, form_data) {
|
function login(args, form_data) {
|
||||||
|
$('body').css('cursor', 'progress');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/coinc/accounts/login/',
|
url: './accounts/login/',
|
||||||
data: form_data,
|
data: form_data,
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
|
// TODO nötig, da der csrf-token nach dem anmelden geändert wird und ich mir erst den neuen holen muss.
|
||||||
window.open(window.location.href, '_self');
|
window.open(window.location.href, '_self');
|
||||||
//detach('#login');
|
detach('#login');
|
||||||
//$('button#do_login').addClass('d-none');
|
//$('button#do_login').addClass('d-none');
|
||||||
//$('button#begin_edit').removeClass('d-none');
|
//$('button#begin_edit').removeClass('d-none');
|
||||||
//$('button#do_logout').removeClass('d-none');
|
//$('button#do_logout').removeClass('d-none');
|
||||||
@ -255,19 +257,20 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// logout
|
// logout
|
||||||
$('#do_logout').click(function() {
|
$('#do_logout').click(function() {
|
||||||
let data = { csrfmiddlewaretoken: $('input[name=csrfmiddlewaretoken]').val() };
|
$('body').css('cursor', 'progress');
|
||||||
$.ajax({
|
let data = { csrfmiddlewaretoken: $('input[name=csrfmiddlewaretoken]').val() };
|
||||||
type: 'POST',
|
$.ajax({
|
||||||
data: data,
|
type: 'POST',
|
||||||
url: '/coinc/accounts/logout/',
|
data: data,
|
||||||
success: function(response) {
|
url: './accounts/logout/',
|
||||||
window.open(window.location.href, '_self');
|
success: function(response) {
|
||||||
//detach('login');
|
// TODO nötig, da der csrf-token nach dem anmelden geändert wird und ich mir erst den neuen holen muss.
|
||||||
//$('button#do_logout').addClass('d-none');
|
window.open('./', '_self');
|
||||||
//$('button#begin_edit').addClass('d-none');
|
//$('button#do_logout').addClass('d-none');
|
||||||
//$('button#do_login').removeClass('d-none');
|
//$('button#begin_edit').addClass('d-none');
|
||||||
}
|
//$('button#do_login').removeClass('d-none');
|
||||||
});
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user