Compare commits

...

2 Commits

3 changed files with 12 additions and 4 deletions

View File

@ -4,7 +4,7 @@ host = "localhost"
port = 11000 port = 11000
reloader = True reloader = True
debug = False debug = False
server = 'wsgiref' # try 'gunicorn' server = 'paste' # try 'gunicorn'
session_opts = { session_opts = {
'session.type': 'file', 'session.type': 'file',

View File

@ -6,9 +6,10 @@
# You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/. # You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
from bottle import Bottle, route, request, response, redirect from bottle import Bottle, route, request, response, redirect
from config import directory from config import directory, globalvar
import json import json
import requests
import templates.plain.main as template_public import templates.plain.main as template_public
import templates.postcard.main as template_email import templates.postcard.main as template_email
@ -99,8 +100,14 @@ def index():
"jwt" : beaker_session["token"], "jwt" : beaker_session["token"],
"type" : "out" "type" : "out"
} }
response_session = api_auth.auth().session(params) print("Remove token from database")
response_logout = api_auth.auth().logout(params) requests_headers = {
"Authorization": f"Bearer {params['jwt']}"
}
requests_callback = requests.post(f'{globalvar.baseurl}/api/auth/logout', headers=requests_headers)
response_logout = requests_callback.json()
print("Remove token from beaker")
response_session = api_auth.auth().session(params)
if response_session['status'] == 'success' and response_logout['status'] == 'success' : if response_session['status'] == 'success' and response_logout['status'] == 'success' :
redirect('/?message=logout success') redirect('/?message=logout success')
else: else:

View File

@ -4,6 +4,7 @@ python3 -m venv .venv # Create .venv
.venv/bin/pip3 install bottle # Micro Framework .venv/bin/pip3 install bottle # Micro Framework
.venv/bin/pip3 install gunicorn # WSGI Server Backend .venv/bin/pip3 install gunicorn # WSGI Server Backend
.venv/bin/pip3 install paste # WSGI Server Backend that support circular call
.venv/bin/pip3 install beaker # Session & caching library .venv/bin/pip3 install beaker # Session & caching library
.venv/bin/pip3 install mako # Template library .venv/bin/pip3 install mako # Template library