diff --git a/app/routes.py b/app/routes.py index 9270521..a103d2d 100644 --- a/app/routes.py +++ b/app/routes.py @@ -100,18 +100,21 @@ def verify_email(token): user = Participant.query.filter_by(email=email).first_or_404() if get_confirmed_count() >= current_app.config['MAX_SPOTS']: - return render_template("error.html", error_message="Sorry! The event filled up while you were verifying.") + if user.confirmed: + return render_template('success.html', message="You are confirmed", discord_link=current_app.config['DISCORD_LINK'], discord_token=user.discord_token) + else: + return render_template("error.html", error_message="Sorry! The event filled up while you were verifying.") + else: + user.confirmed = True + db.session.commit() - user.confirmed = True - db.session.commit() - - discord_link = current_app.config['DISCORD_LINK'] - discord_token = user.discord_token - msg = "You are confirmed!" - if user.looking_for_team: - msg += " Since you need a team, please join the #team-search channel." - - return render_template('success.html', message=msg, discord_link=discord_link, discord_token=discord_token) + discord_link = current_app.config['DISCORD_LINK'] + discord_token = user.discord_token + msg = "You are confirmed!" + if user.looking_for_team: + msg += " Since you need a team, please join the #team-search channel." + + return render_template('success.html', message=msg, discord_link=discord_link, discord_token=discord_token) @bp.route('/remove/') @limiter.limit("5 per hour")