Update: Fields empty
This commit is contained in:
parent
78bc60a4c0
commit
539311990b
1 changed files with 14 additions and 16 deletions
|
|
@ -10,10 +10,10 @@ bp = Blueprint('myapp', __name__)
|
||||||
# Login
|
# Login
|
||||||
@bp.route('/api/login', methods=['POST'])
|
@bp.route('/api/login', methods=['POST'])
|
||||||
def login():
|
def login():
|
||||||
|
try:
|
||||||
post_json = request.json
|
post_json = request.json
|
||||||
post_email = str(post_json['email'])
|
post_email = str(post_json['email'])
|
||||||
post_password = str(post_json['password'])
|
post_password = str(post_json['password'])
|
||||||
if post_email and post_password:
|
|
||||||
if post_email != '' and post_password != '':
|
if post_email != '' and post_password != '':
|
||||||
ip = request.remote_addr
|
ip = request.remote_addr
|
||||||
res = db_login(ip, post_email, post_password)
|
res = db_login(ip, post_email, post_password)
|
||||||
|
|
@ -27,7 +27,7 @@ def login():
|
||||||
return send_error(404, res['message'], token)
|
return send_error(404, res['message'], token)
|
||||||
else:
|
else:
|
||||||
return send_error(400, 'Empty email and/or password fields.')
|
return send_error(400, 'Empty email and/or password fields.')
|
||||||
else:
|
except KeyError as e:
|
||||||
return send_error(400, 'Need email, password fields.')
|
return send_error(400, 'Need email, password fields.')
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -39,8 +39,6 @@ def register():
|
||||||
post_email = str(post_json['email'])
|
post_email = str(post_json['email'])
|
||||||
post_nickname = str(post_json['nickname'])
|
post_nickname = str(post_json['nickname'])
|
||||||
post_password = str(post_json['password'])
|
post_password = str(post_json['password'])
|
||||||
|
|
||||||
if post_email and post_nickname and post_password:
|
|
||||||
if post_email != '' and post_password != '' and post_nickname != '':
|
if post_email != '' and post_password != '' and post_nickname != '':
|
||||||
ip = request.remote_addr
|
ip = request.remote_addr
|
||||||
res = db_register(ip, post_email, post_nickname, post_password)
|
res = db_register(ip, post_email, post_nickname, post_password)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue