-
This commit is contained in:
parent
17badd6e1c
commit
e1a8e765ce
8
app.py
8
app.py
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user