When an email code has already been used, just redirect to signin.
This commit is contained in:
parent
d0e62d2099
commit
dec74fc608
2 changed files with 10 additions and 3 deletions
|
@ -327,8 +327,11 @@ def create_confirm_email_code(user):
|
||||||
|
|
||||||
|
|
||||||
def confirm_user_email(code):
|
def confirm_user_email(code):
|
||||||
code = EmailConfirmation.get(EmailConfirmation.code == code,
|
try:
|
||||||
EmailConfirmation.email_confirm == True)
|
code = EmailConfirmation.get(EmailConfirmation.code == code,
|
||||||
|
EmailConfirmation.email_confirm == True)
|
||||||
|
except EmailConfirmation.DoesNotExist:
|
||||||
|
raise DataModelException('Invalid email confirmation code.')
|
||||||
|
|
||||||
user = code.user
|
user = code.user
|
||||||
user.verified = True
|
user.verified = True
|
||||||
|
|
|
@ -226,7 +226,11 @@ def github_oauth_callback():
|
||||||
@app.route('/confirm', methods=['GET'])
|
@app.route('/confirm', methods=['GET'])
|
||||||
def confirm_email():
|
def confirm_email():
|
||||||
code = request.values['code']
|
code = request.values['code']
|
||||||
user = model.confirm_user_email(code)
|
|
||||||
|
try:
|
||||||
|
user = model.confirm_user_email(code)
|
||||||
|
except model.DataModelException as ex:
|
||||||
|
return redirect(url_for('signin'))
|
||||||
|
|
||||||
common_login(user)
|
common_login(user)
|
||||||
|
|
||||||
|
|
Reference in a new issue