Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @app.route('/login', methods=['GET','POST'])
- def login():
- if request.method == 'GET':
- return render_template('login.html')
- elif request.method == 'POST':
- username = str(request.form['username'])
- usertoShow = User.query.filter_by(username=username).first()
- password = str(request.form['password'])
- result = User.query.filter_by(username=username,password=password).first()
- if result:
- session['zalogowany'] = True
- session['user_id'] = result.id
- else:
- flash(Markup('<p><font color="red">Zly login lub haslo.<br>Chcialbys sie </font><a href="/register">zarejestrowac?</a></p>'))
- return render_template('login.html', user_show = usertoShow)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement