def create_passcode_and_send_email(self, email, kit_id): kitids = ag_data.getAGKitIDsByEmail(email) latlongs = ag_data.getMapMarkers() tl = text_locale['handlers'] #if the kit id matches the email generate and send an email if kit_id in kitids: alphabet = letters + digits new_act_code = ''.join([choice(alphabet) for i in range(20)]) # add new pass to the database ag_data.ag_set_pass_change_code(email, kit_id, new_act_code) MESSAGE = (tl['RESET_PASS_BODY'] % (kit_id, quote(email), kit_id, quote(new_act_code))) #send the user an email and tell them to change their password try: send_email(MESSAGE, tl['CHANGE_PASS_SUBJECT'], email) self.render('forgot_password.html', email='', kitid='', result=1, message='', latlongs_db=latlongs, loginerror='') except: self.render('forgot_password.html', email='', kitid='', result=2, message=MESSAGE, latlongs_db=latlongs, loginerror='') else: self.render('forgot_password.html', email='', kitid='', result=3, message='', latlongs_db=latlongs, loginerror='')
def post(self): kit_counts = ag_data.getMapMarkers() email = self.get_argument('email') tl = text_locale['handlers'] if email: kitids = ag_data.getAGKitIDsByEmail(email) try: if len(kitids) > 0: MESSAGE = tl['KIT_IDS_BODY'] % ", ".join(kitids) try: send_email(MESSAGE, tl['KIT_IDS_SUBJECT'], email) self.render('retrieve_kitid.html', message='', output='success', loginerror='', kit_counts=kit_counts) except BaseException: self.render('retrieve_kitid.html', message=MESSAGE, output='noemail', loginerror='', kit_counts=kit_counts) else: self.render('retrieve_kitid.html', message='nokit', output='form', loginerror='', kit_counts=kit_counts) except BaseException: self.render('retrieve_kitid.html', message='', output='exception', loginerror='', kit_counts=kit_counts)
def create_passcode_and_send_email(self, email, kit_id): kitids = ag_data.getAGKitIDsByEmail(email) kit_counts = ag_data.getMapMarkers() tl = text_locale['handlers'] # if the kit id matches the email generate and send an email if kit_id in kitids: alphabet = letters + digits new_act_code = ''.join([choice(alphabet) for i in range(20)]) # add new pass to the database ag_data.ag_set_pass_change_code(email, kit_id, new_act_code) MESSAGE = (tl['RESET_PASS_BODY'] % (kit_id, quote(email), kit_id, quote(new_act_code))) # send the user an email and tell them to change their password try: send_email(MESSAGE, tl['CHANGE_PASS_SUBJECT'], email) self.render('forgot_password.html', email='', kitid='', result=1, message='', kit_counts=kit_counts, loginerror='') except BaseException: self.render('forgot_password.html', email='', kitid='', result=2, message=MESSAGE, kit_counts=kit_counts, loginerror='') else: self.render('forgot_password.html', email='', kitid='', result=3, message='', kit_counts=kit_counts, loginerror='')
def post(self): kit_counts = ag_data.getMapMarkers() email = self.get_argument("email") tl = text_locale["handlers"] if email: kitids = ag_data.getAGKitIDsByEmail(email) try: if len(kitids) > 0: MESSAGE = tl["KIT_IDS_BODY"] % ", ".join(kitids) try: send_email(MESSAGE, tl["KIT_IDS_SUBJECT"], email) self.render( "retrieve_kitid.html", message="", output="success", loginerror="", kit_counts=kit_counts ) except: self.render( "retrieve_kitid.html", message=MESSAGE, output="noemail", loginerror="", kit_counts=kit_counts ) else: self.render("retrieve_kitid.html", message="nokit", output="form", loginerror="", kit_counts=kit_counts) except: self.render("retrieve_kitid.html", message="", output="exception", loginerror="", kit_counts=kit_counts)