def get(self): errmsg = self.get_argument('errmsg', "") kit_id = self.current_user user_info = AG_DATA_ACCESS.get_user_info(kit_id) user_name = user_info['name'] kit_details = AG_DATA_ACCESS.getAGKitDetails(kit_id) kit_verified = True if kit_details['kit_verified'] == 'y' else False results = AG_DATA_ACCESS.get_barcode_results(kit_id) has_results = len(results) != 0 barcodes = AG_DATA_ACCESS.getBarcodesByKit(kit_id) kit_ver_error = False verification_textbox = '' self.render("portal.html", skid=kit_id, user_name=user_name, errmsg=errmsg, kit_verified=kit_verified, has_results=has_results, results=results, barcodes=barcodes, kit_ver_error=kit_ver_error, verification_textbox=verification_textbox)
def post(self): kit_id = self.current_user errmsg = self.get_argument('errmsg', "") user_code = self.get_argument('user_verification_code') kit_details = AG_DATA_ACCESS.getAGKitDetails(kit_id) barcodes = AG_DATA_ACCESS.getBarcodesByKit(kit_id) user_info = AG_DATA_ACCESS.get_user_info(kit_id) user_name = user_info['name'] results = AG_DATA_ACCESS.get_barcode_results(kit_id) has_results = len(results) != 0 kit_verified = True if kit_details['kit_verified'] == 'y' else False if kit_details['kit_verification_code'] == user_code: AG_DATA_ACCESS.verifyKit(kit_id) kit_ver_error = False verification_textbox = '' else: kit_ver_error = True verification_textbox = ' highlight' self.render("portal.html", skid=kit_id, user_name=user_name, errmsg=errmsg, kit_verified=kit_verified, has_results=has_results, results=results, barcodes=barcodes, verification_textbox=verification_textbox, kit_ver_error=kit_ver_error)
def post(self): kit_id = self.current_user errmsg = self.get_argument('errmsg', "") user_code = self.get_argument('user_verification_code') kit_details = AG_DATA_ACCESS.getAGKitDetails(kit_id) barcodes = AG_DATA_ACCESS.getBarcodesByKit(kit_id) user_info = AG_DATA_ACCESS.get_user_info(kit_id) user_name = user_info['name'] results = AG_DATA_ACCESS.get_barcode_results(kit_id) has_results = len(results) != 0 kit_verified = True if kit_details['kit_verified'] == 'y' else False if kit_details['kit_verification_code'] == user_code: AG_DATA_ACCESS.verifyKit(kit_id) kit_ver_error = False verification_textbox = '' else: kit_ver_error = True verification_textbox = ' highlight' self.render("portal.html", skid=kit_id, user_name=user_name, errmsg=errmsg, kit_verified=kit_verified, has_results=has_results, results=results, barcodes=barcodes, verification_textbox=verification_textbox, kit_ver_error=kit_ver_error)
def post(self): skid = self.current_user tl=text_locale['handlers'] info = {} for info_column in ("email", "participantname", "address", "city", "state", "zip", "country"): # Make sure that all fields were entered info[info_column] = self.get_argument(info_column, None) # create the user if needed ag_login_id = AG_DATA_ACCESS.addAGLogin( info['email'], info['participantname'], info['address'], info['city'], info['state'], info['zip'], info['country']) # Create the kit and add the kit to the user kitinfo = AG_DATA_ACCESS.getAGHandoutKitDetails(skid) printresults = AG_DATA_ACCESS.checkPrintResults(skid) if printresults is None: printresults = 'n' success = AG_DATA_ACCESS.addAGKit( ag_login_id, skid, kitinfo['password'], kitinfo['swabs_per_kit'], kitinfo['verification_code'], printresults) if success == -1: self.redirect(media_locale['SITEBASE'] + '/db_error/?err=regkit') return # Add the barcodes kitinfo = AG_DATA_ACCESS.getAGKitDetails(skid) ag_kit_id = kitinfo['ag_kit_id'] results = AG_DATA_ACCESS.get_barcodes_from_handout_kit(skid) for row in results: barcode = row[0] success = AG_DATA_ACCESS.addAGBarcode(ag_kit_id, barcode) if success == -1: self.redirect(media_locale['SITEBASE'] + '/db_error/?err=regbarcode') return # Email the verification code subject = tl['AUTH_SUBJECT'] addendum = '' if skid.startswith('PGP_'): addendum = tl['AUTH_REGISTER_PGP'] body = tl['AUTH_REGISTER_BODY'].format( kitinfo['kit_verification_code'], addendum) result = tl['KIT_REG_SUCCESS'] try: send_email(body, subject, recipient=info['email'], sender=media_locale['HELP_EMAIL']) except: result = media_locale['EMAIL_ERROR'] self.render('help_request.html', skid=skid, result=result) self.redirect(media_locale['SITEBASE'] + '/authed/portal/')
def get(self): errmsg = self.get_argument('errmsg', "") kit_id = self.current_user user_info = AG_DATA_ACCESS.get_user_info(kit_id) user_name = user_info['name'] kit_details = AG_DATA_ACCESS.getAGKitDetails(kit_id) kit_verified = True if kit_details['kit_verified'] == 'y' else False results = AG_DATA_ACCESS.get_barcode_results(kit_id) has_results = len(results) != 0 barcodes = AG_DATA_ACCESS.getBarcodesByKit(kit_id) kit_ver_error = False verification_textbox = '' self.render("portal.html", skid=kit_id, user_name=user_name, errmsg=errmsg, kit_verified=kit_verified, has_results=has_results, results=results, barcodes=barcodes, kit_ver_error=kit_ver_error, verification_textbox=verification_textbox)