forked from ticketfrei/ticketfrei
check if user already exists on registering
This commit is contained in:
parent
7ccf6917c8
commit
1b75e03fc5
|
@ -43,7 +43,7 @@ def login():
|
||||||
uname = bottle.request.forms.get('uname')
|
uname = bottle.request.forms.get('uname')
|
||||||
psw = bottle.request.forms.get('psw')
|
psw = bottle.request.forms.get('psw')
|
||||||
psw = psw.encode("utf-8")
|
psw = psw.encode("utf-8")
|
||||||
db.cur.execute("SELECT pass_hashed FROM user WHERE email=?;", (uname, )), psw
|
db.cur.execute("SELECT pass_hashed FROM user WHERE email=?;", (uname, ))
|
||||||
try:
|
try:
|
||||||
pass_hashed = db.cur.fetchone()[0]
|
pass_hashed = db.cur.fetchone()[0]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
@ -69,6 +69,9 @@ def register():
|
||||||
return "ERROR: Passwords don't match. Try again."
|
return "ERROR: Passwords don't match. Try again."
|
||||||
|
|
||||||
# check if email is already in use
|
# check if email is already in use
|
||||||
|
db.cur.execute("SELECT id FROM user WHERE email=?;", (email,))
|
||||||
|
if db.cur.fetchone() is not None:
|
||||||
|
return "E-Mail is already in use." # account already exists
|
||||||
|
|
||||||
# hash and format for being encoded in the confirmation mail
|
# hash and format for being encoded in the confirmation mail
|
||||||
psw = psw.encode("utf-8")
|
psw = psw.encode("utf-8")
|
||||||
|
|
Loading…
Reference in a new issue