Example #1
0
    def get(self):
        errmsg = self.get_argument('errmsg', "")
        kit_id = self.current_user

        user_info = ag_data.get_user_info(kit_id)

        if not user_info:
            self.redirect(media_locale['SITEBASE'] + '/auth/logout/')
            return

        user_name = user_info['name']

        kit_details = ag_data.getAGKitDetails(kit_id)
        kit_verified = True if kit_details['kit_verified'] == 'y' else False

        results = ag_data.get_barcode_results(kit_id)
        has_results = len(results) != 0

        barcodes = ag_data.getBarcodesByKit(kit_id)

        kit_ver_error = False
        verification_textbox = ''
        unconsented = ag_data.get_nonconsented_scanned_barcodes(kit_id)

        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,
                    unconsented=unconsented)
    def get(self):
        errmsg = self.get_argument('errmsg', "")
        kit_id = self.current_user

        user_info = ag_data.get_user_info(kit_id)

        if not user_info:
            self.redirect(media_locale['SITEBASE'] + '/auth/logout/')
            return

        user_name = user_info['name']

        kit_details = ag_data.getAGKitDetails(kit_id)
        kit_verified = True if kit_details['kit_verified'] == 'y' else False

        results = ag_data.get_barcode_results(kit_id)
        has_results = len(results) != 0

        barcodes = ag_data.getBarcodesByKit(kit_id)

        kit_ver_error = False
        verification_textbox = ''
        unconsented = ag_data.get_nonconsented_scanned_barcodes(kit_id)

        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,
                    unconsented=unconsented)
Example #3
0
    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.getAGKitDetails(kit_id)
        barcodes = ag_data.getBarcodesByKit(kit_id)
        user_info = ag_data.get_user_info(kit_id)
        user_name = user_info['name']
        results = ag_data.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.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)
Example #4
0
 def get(self):
     user_info = ag_data.get_user_info(self.current_user)
     self.render('change_password.html',
                 email=user_info['email'],
                 skid=self.current_user,
                 new_password=None,
                 confirm_password=None,
                 result='valid',
                 message=None)
Example #5
0
    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.getAGKitDetails(kit_id)
        barcodes = ag_data.getBarcodesByKit(kit_id)
        user_info = ag_data.get_user_info(kit_id)
        user_name = user_info['name']
        results = ag_data.get_barcode_results(kit_id)
        has_results = len(results) != 0
        unconsented = ag_data.get_nonconsented_scanned_barcodes(kit_id)

        kit_verified = True if kit_details['kit_verified'] == 'y' else False

        if not kit_verified and user_code == "":
            # Resend kit verification code
            tl = text_locale['handlers']
            subject = tl['AUTH_SUBJECT']
            addendum = ''
            if self.current_user.startswith('PGP_'):
                addendum = tl['AUTH_REGISTER_PGP']

            body = tl['AUTH_REGISTER_BODY'].format(
                kit_details['kit_verification_code'], addendum)

            kit_ver_error = False
            verification_textbox = ''
            try:
                send_email(body,
                           subject,
                           recipient=user_info['email'],
                           sender=media_locale['HELP_EMAIL'])
            except BaseException:
                errmsg = media_locale['EMAIL_ERROR']
        else:
            # Verify the given kit verification code
            if kit_details['kit_verification_code'] == user_code:
                ag_data.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,
                    unconsented=unconsented)
    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.getAGKitDetails(kit_id)
        barcodes = ag_data.getBarcodesByKit(kit_id)
        user_info = ag_data.get_user_info(kit_id)
        user_name = user_info['name']
        results = ag_data.get_barcode_results(kit_id)
        has_results = len(results) != 0
        unconsented = ag_data.get_nonconsented_scanned_barcodes(kit_id)

        kit_verified = True if kit_details['kit_verified'] == 'y' else False

        if not kit_verified and user_code == "":
            # Resend kit verification code
            tl = text_locale['handlers']
            subject = tl['AUTH_SUBJECT']
            addendum = ''
            if self.current_user.startswith('PGP_'):
                addendum = tl['AUTH_REGISTER_PGP']

            body = tl['AUTH_REGISTER_BODY'].format(
                kit_details['kit_verification_code'], addendum)

            kit_ver_error = False
            verification_textbox = ''
            try:
                send_email(body, subject, recipient=user_info['email'],
                           sender=media_locale['HELP_EMAIL'])
            except:
                errmsg = media_locale['EMAIL_ERROR']
        else:
            # Verify the given kit verification code
            if kit_details['kit_verification_code'] == user_code:
                ag_data.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, unconsented=unconsented)
Example #7
0
    def get(self):
        errmsg = self.get_argument('errmsg', "")
        kit_id = self.current_user

        user_info = ag_data.get_user_info(kit_id)
        user_name = user_info['name']

        kit_details = ag_data.getAGKitDetails(kit_id)
        kit_verified = True if kit_details['kit_verified'] == 'y' else False

        results = ag_data.get_barcode_results(kit_id)
        has_results = len(results) != 0

        barcodes = ag_data.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 get(self):
     user_info = ag_data.get_user_info(self.current_user)
     self.render('change_password.html', email=user_info['email'],
                 skid=self.current_user, new_password=None,
                 confirm_password=None, result='valid', message=None)
    def post(self):
        tl = text_locale['handlers']
        deceased_parent = self.get_argument("deceased_parent", None)
        participant_name = self.get_argument("participant_name")
        participant_email = self.get_argument("participant_email")
        is_juvenile = self.get_argument("is_juvenile", 'off')
        parent_1_name = self.get_argument("parent_1_name", None)
        parent_2_name = self.get_argument("parent_2_name", None)

        ag_login_id = ag_data.get_user_for_kit(self.current_user)
        kit_email = ag_data.get_user_info(self.current_user)['email']

        # Check if the participant is on the exceptions list
        is_exception = (
            participant_name
            in ag_data.getParticipantExceptions(ag_login_id))

        # If the participant already exists, stop them outright
        if ag_data.check_if_consent_exists(ag_login_id, participant_name):
            errmsg = url_escape(tl['PARTICIPANT_EXISTS'] % participant_name)
            self.redirect(media_locale['SITEBASE'] + "/authed/portal/?errmsg=%s" % errmsg)
            return

        if is_juvenile == 'off' and is_exception:
            errmsg = url_escape(tl["JUVENILE_CONSENT_EXPECTED"] %
                                participant_name)
            self.redirect(media_locale['SITEBASE'] + "/authed/portal/?errmsg=%s" % errmsg)
            return

        if is_juvenile == 'on':
            # If they aren't already an exception, we need to verify them
            if not is_exception:
                alert_message = tl['MINOR_PARENTAL_BODY']

                subject = ("AGJUVENILE: %s (ag_login_id: %s) is a child"
                           % (participant_name, ag_login_id))

                message = MESSAGE_TEMPLATE % (participant_name,
                                              parent_1_name, parent_2_name,
                                              deceased_parent,
                                              self.current_user, kit_email)

                try:
                    send_email(message, subject, sender=kit_email)
                    alert_message = tl['MESSAGE_SENT']
                except:
                    alert_message = media_locale['EMAIL_ERROR']

                self.redirect(media_locale['SITEBASE'] + "/authed/portal/?errmsg=%s" % alert_message)
                return

        human_survey_id = binascii.hexlify(os.urandom(8))

        consent= {'participant_name': participant_name,
                  'participant_email': participant_email,
                  'parent_1_name': parent_1_name,
                  'parent_2_name': parent_2_name,
                  'is_juvenile': True if is_juvenile == 'on' else False,
                  'deceased_parent': deceased_parent,
                  'login_id': ag_login_id,
                  'survey_id': human_survey_id}

        redis.hset(human_survey_id, 'consent', dumps(consent))
        redis.expire(human_survey_id, 86400)

        self.set_secure_cookie('human_survey_id', human_survey_id)
        self.redirect(media_locale['SITEBASE'] + "/authed/survey_main/")