I have a method the problem is sometimes I want to redirect to 1 route and sometimes I want to redirect to another different route.
How do I accomplish this ?
def wait_max_thirty_min_for_new_token(self):
'''
Wait a max of 30 min before getting the last emailed token.
This only happens when creating the last token.
Else redirect to the registration_verification_code route.
'''
time_token_expired_db = self.time_token_expired
# executes at 9:00 <= 9:30pm
current_time = datetime.now()
if self and self.attempts_token_tried >= 5 and current_time <= time_token_expired_db:
# only works duringb pytest
print('wait_max_thirty_min_for_new_token, success')
# create times for the created token + expired token
# better wording.lf
flash('You have requested to many tokens. Please wait 30 minutes for a new token from when you recieved your last token.')
return redirect(url_for('email_login_confirmation.registration_verification_code', username_db=self.username))
else:
# is this secure?
return None