Redirect to tiny login form on /login GET
This commit is contained in:
parent
d5be15a827
commit
6ea74adc90
|
@ -63,14 +63,23 @@ class CLForm(Form):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@writing_blueprint.route('/login', methods=['POST'])
|
@writing_blueprint.route('/login', methods=['POST', 'GET'])
|
||||||
def login_post():
|
def login_post():
|
||||||
|
if request.method == 'POST':
|
||||||
username = request.form['username']
|
username = request.form['username']
|
||||||
if db.login(username, request.form['password']):
|
if db.login(username, request.form['password']):
|
||||||
session['username'] = username
|
session['username'] = username
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
return make_response("", 401)
|
return make_response("", 401)
|
||||||
|
|
||||||
|
return '''
|
||||||
|
<form method="post">
|
||||||
|
<p><input type=text name=username></p>
|
||||||
|
<p><input type=password name=password></p>
|
||||||
|
<p><input type=submit value=Login></p>
|
||||||
|
</form>
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
@writing_blueprint.route('/', methods=['GET'])
|
@writing_blueprint.route('/', methods=['GET'])
|
||||||
def index_get():
|
def index_get():
|
||||||
|
|
Loading…
Reference in New Issue