Browse Source

v7.0.0.0

Changelog: https://roxy-wi.org/changelog#7.0.0
pull/364/head
Aidaho 1 year ago
parent
commit
8d3111c15f
  1. 7
      app/modules/roxywi/auth.py
  2. 25
      app/routes/main/routes.py

7
app/modules/roxywi/auth.py

@ -12,11 +12,6 @@ def check_login(user_uuid, token, **kwargs) -> str:
if user_uuid is None:
return 'login_page'
try:
sql.delete_old_uuid()
except Exception as e:
raise Exception(f'error: cannot connect to DB {e}')
if user_uuid is not None:
if sql.get_user_name_by_uuid(user_uuid) is None:
return 'login_page'
@ -127,7 +122,7 @@ def do_login(user_uuid: str, user_group: str, user: str, next_url: str):
login_user(user)
resp = make_response(redirect_to)
resp.set_cookie('uuid', user_uuid, secure=True, expires=expires.strftime("%a, %d %b %Y %H:%M:%S GMT"), httponly=True, samesite='Strict')
resp.set_cookie('group', str(user_group), secure=True, expires=expires.strftime("%a, %d %b %Y %H:%M:%S GMT"), httponly=True, samesite='Strict')
resp.set_cookie('group', str(user_group), expires=expires.strftime("%a, %d %b %Y %H:%M:%S GMT"), samesite='Strict')
try:
user_group_name = sql.get_group_name_by_id(user_group)

25
app/routes/main/routes.py

@ -20,6 +20,16 @@ import modules.service.common as service_common
import modules.service.haproxy as service_haproxy
@app.errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@app.errorhandler(500)
def page_not_found(e):
return render_template('500.html', e=e), 500
@app.before_request
def make_session_permanent():
session.permanent = True
@ -31,16 +41,6 @@ def _db_close(exc):
conn.close()
@bp.errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@bp.errorhandler(500)
def page_not_found(e):
return render_template('500.html', e=e), 500
@bp.route('/stats/<service>/', defaults={'serv': None})
@bp.route('/stats/<service>/<serv>')
@login_required
@ -150,11 +150,6 @@ def service_history(service, server_ip):
elif service == 'user':
history = sql.select_action_history_by_user_id(server_ip)
try:
sql.delete_action_history_for_period()
except Exception as e:
print(e)
return render_template(
'history.html', role=user_params['role'], user=user, users=users, serv=server_ip, service=service,
history=history, user_services=user_params['user_services'], token=user_params['token'],

Loading…
Cancel
Save