From 54a98b77d90067cd53c6bff6c7a7d927ec40f1c9 Mon Sep 17 00:00:00 2001 From: LoveEevee Date: Tue, 17 Mar 2020 11:07:29 +0300 Subject: [PATCH] Fix logging out and the Remember me checkbox --- app.py | 3 +-- public/src/js/account.js | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 0667bba..8a710e1 100644 --- a/app.py +++ b/app.py @@ -397,8 +397,7 @@ def route_api_login(): session['session_id'] = result['session_id'] session['username'] = result['username'] - if data.get('remember'): - session.permanent = True + session.permanent = True if data.get('remember') else False return jsonify({'status': 'ok', 'username': result['username'], 'display_name': result['display_name']}) diff --git a/public/src/js/account.js b/public/src/js/account.js index b40bcc4..1df6723 100644 --- a/public/src/js/account.js +++ b/public/src/js/account.js @@ -422,9 +422,11 @@ class Account{ this.lock(false) reject() }) + if(!get){ + request.setRequestHeader("X-CSRFToken", token) + } if(obj){ request.setRequestHeader("Content-Type", "application/json;charset=UTF-8") - request.setRequestHeader("X-CSRFToken", token) request.send(JSON.stringify(obj)) }else{ request.send()