This commit is contained in:
Mateusz779 2023-04-13 11:56:36 +02:00
parent 17badd6e1c
commit e1a8e765ce
3 changed files with 4 additions and 4 deletions

8
app.py
View File

@ -20,8 +20,8 @@ def main():
auth_token = request.cookies.get('auth_token') auth_token = request.cookies.get('auth_token')
if auth_token != "" or auth_token is not None: if auth_token != "" or auth_token is not None:
if db.get_user_bytoken(auth_token) is None: if db.get_user_bytoken(auth_token) is None:
return render_template('template/login.html') return render_template('login.html')
return render_template('template/index.html') return render_template('index.html')
@app.route('/api/login', methods=['POST']) @app.route('/api/login', methods=['POST'])
def login_post(): def login_post():
@ -31,9 +31,9 @@ def login_post():
auth_token = db.login() auth_token = db.login()
if auth_token is None: if auth_token is None:
flash('Nieprawidłowa nazwa użytkownika lub hasło.', 'error') flash('Nieprawidłowa nazwa użytkownika lub hasło.', 'error')
return redirect(url_for('login')) return redirect(url_for('/'))
response = make_response(render_template('template/index.html')) response = make_response(render_template('index.html'))
response.set_cookie('auth_token', auth_token) response.set_cookie('auth_token', auth_token)
return response return response