Fix issue with login security

This commit is contained in:
Moravčík, Marian 2020-12-10 13:46:12 +01:00
parent 855727643b
commit ab5dd535e9
2 changed files with 13 additions and 12 deletions

View File

@ -37,13 +37,6 @@ def create_app():
toolbar = DebugToolbarExtension(app)
@app.errorhandler(404)
def page_not_found(e):
if request.path == '/':
return redirect(url_for('series'), code=302)
return render_template('404.html'), 404
socketio.init_app(app, path=base_url.rstrip('/')+'/socket.io', cors_allowed_origins='*', async_mode='threading')
return app

View File

@ -86,6 +86,14 @@ def login_required(f):
return wrap
@app.errorhandler(404)
@login_required
def page_not_found(e):
if request.path == '/':
return redirect(url_for('series'), code=302)
return render_template('404.html'), 404
@app.route('/login/', methods=["GET", "POST"])
def login_page():
error = ''
@ -269,9 +277,9 @@ def historystats():
data_languages_list = []
for item in data_languages:
splitted_lang = item['language'].split(':')
item = {"name": language_from_alpha2(splitted_lang[0]),
"code2": splitted_lang[0],
"code3": alpha3_from_alpha2(splitted_lang[0]),
item = {"name" : language_from_alpha2(splitted_lang[0]),
"code2" : splitted_lang[0],
"code3" : alpha3_from_alpha2(splitted_lang[0]),
"forced": True if len(splitted_lang) > 1 else False}
data_languages_list.append(item)
@ -490,8 +498,8 @@ def test_notification(protocol, provider):
apobj.add(protocol + "://" + provider)
apobj.notify(
title='Bazarr test notification',
body='Test notification'
title='Bazarr test notification',
body='Test notification'
)
return '', 200