Exemple #1
0
    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 post(self):
        skid = self.get_argument("skid", "").strip()
        password = self.get_argument("password", "")
        tl = text_locale['handlers']

        is_handout = ag_data.handoutCheck(skid, password)
        if is_handout:
            # have them register themselves
            self.redirect(media_locale['SITEBASE'] + '/?loginerror=' +
                          tl['REGISTER_KIT'])
            return

        login = ag_data.authenticateWebAppUser(skid, password)
        if login:
            # everything good so log in
            self.set_current_user(skid)
            default_redirect = media_locale['SITEBASE'] + '/authed/portal/'
            self.redirect(self.get_argument('next', default_redirect))
            return
        else:
            msg = tl['INVALID_KITID']
            kit_counts = ag_data.getMapMarkers()
            self.render("index.html",
                        user=None,
                        loginerror=msg,
                        kit_counts=kit_counts)
            return
    def post(self):
        skid = self.get_argument("skid", "").strip()
        password = self.get_argument("password", "")
        tl = text_locale['handlers']

        is_handout = ag_data.handoutCheck(skid, password)
        if is_handout:
            # have them register themselves
            self.redirect(media_locale['SITEBASE'] + '/?loginerror=' +
                          tl['REGISTER_KIT'])
            return

        login = ag_data.authenticateWebAppUser(skid, password)
        if login:
            # everything good so log in
            self.set_current_user(skid)
            default_redirect = media_locale['SITEBASE'] + '/authed/portal/'
            self.redirect(self.get_argument('next', default_redirect))
            return
        else:
            msg = tl['INVALID_KITID']
            latlongs_db = ag_data.getMapMarkers()
            self.render("index.html", user=None, loginerror=msg,
                        latlongs_db=latlongs_db)
            return
 def get(self):
     email = self.get_argument('email', None)
     kitid = self.get_argument('kitid', None)
     latlongs = ag_data.getMapMarkers()
     self.render('forgot_password.html', email=email, kitid=kitid,
                 result=None, messaage='',
                 latlongs_db=latlongs, loginerror='')
 def get(self):
     kit_counts = ag_data.getMapMarkers()
     countries = ag_data.get_countries()
     self.render("register_user.html",
                 kit_counts=kit_counts,
                 loginerror='',
                 countries=countries)
    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 get(self):
        kit_counts = ag_data.getMapMarkers()
        countries = ag_data.get_countries()

        # defaults entries dict to be empty
        entries = defaultdict(str)
        self.render("register_user.html", kit_counts=kit_counts,
                    loginerror='', countries=countries, entries=entries)
Exemple #8
0
 def get(self):
     email = self.get_argument('email', None)
     kitid = self.get_argument('kitid', None)
     kit_counts = ag_data.getMapMarkers()
     self.render('forgot_password.html',
                 email=email,
                 kitid=kitid,
                 result=None,
                 messaage='',
                 kit_counts=kit_counts,
                 loginerror='')
Exemple #9
0
    def get(self):
        kit_counts = ag_data.getMapMarkers()
        countries = ag_data.get_countries()

        # defaults entries dict to be empty
        entries = defaultdict(str)
        self.render("register_user.html",
                    kit_counts=kit_counts,
                    loginerror='',
                    countries=countries,
                    entries=entries)
 def reset_pass_and_email(self, new_password, confirm_password, email,
                          supplied_kit_id):
     ag_data.ag_update_kit_password(supplied_kit_id, new_password)
     latlongs = ag_data.getMapMarkers()
     tl = text_locale['handlers']
     MESSAGE = tl['CHANGE_PASS_BODY'] % supplied_kit_id
     try:
         send_email(MESSAGE, tl['CHANGE_PASS_SUBJECT'], email)
         self.render('change_pass_verify.html', email='', kitid='',
                     passocde='', new_password='',
                     confirm_password='', result=4, message='',
                     latlongs_db=latlongs, loginerror='')
     except:
         self.render('change_pass_verify.html', email='', kitid='',
                     passocde='', new_password='',
                     confirm_password='', result=5, message='',
                     latlongs_db=latlongs, loginerror='')
    def get(self):
        email = self.get_argument('email', None)
        if email is not None:
            email = unquote(email)
        kitid = self.get_argument('kitid', None)
        passcode = self.get_argument('passcode', None)
        new_password = self.get_argument('new_password', None)
        confirm_password = self.get_argument('confirm_password', None)

        if self.is_valid(email, kitid, passcode):
            result = 'valid'
        else:
            result = 'notvalid'
        kit_counts = ag_data.getMapMarkers()
        self.render('change_pass_verify.html', email=email, kitid=kitid,
                    passcode=passcode, new_password=new_password,
                    confirm_password=confirm_password,
                    result=result, message=None, kit_counts=kit_counts,
                    loginerror='')
    def get(self):
        email = self.get_argument('email', None)
        if email is not None:
            email = unquote(email)
        kitid = self.get_argument('kitid', None)
        passcode = self.get_argument('passcode', None)
        new_password = self.get_argument('new_password', None)
        confirm_password = self.get_argument('confirm_password', None)

        if self.is_valid(email, kitid, passcode):
            result = 'valid'
        else:
            result = 'notvalid'
        kit_counts = ag_data.getMapMarkers()
        self.render('change_pass_verify.html', email=email, kitid=kitid,
                    passcode=passcode, new_password=new_password,
                    confirm_password=confirm_password,
                    result=result, message=None, kit_counts=kit_counts,
                    loginerror='')
 def reset_pass_and_email(self, new_password, confirm_password, email,
                          supplied_kit_id):
     ag_data.ag_update_kit_password(supplied_kit_id, new_password)
     kit_counts = ag_data.getMapMarkers()
     tl = text_locale['handlers']
     MESSAGE = tl['CHANGE_PASS_BODY'] % supplied_kit_id
     try:
         send_email(MESSAGE, tl['CHANGE_PASS_SUBJECT'], email)
         # result=4 is for showing message in if statement of
         # change_pass_verify.html
         self.render('change_pass_verify.html', email='', kitid='',
                     passocde='', new_password='',
                     confirm_password='', result=4, message='',
                     kit_counts=kit_counts, loginerror='')
     except:
         # result=5 is for showing message in if statement of
         # change_pass_verify.html
         self.render('change_pass_verify.html', email='', kitid='',
                     passocde='', new_password='',
                     confirm_password='', result=5, message='',
                     kit_counts=kit_counts, loginerror='')
 def reset_pass_and_email(self, new_password, confirm_password, email,
                          supplied_kit_id):
     ag_data.ag_update_kit_password(supplied_kit_id, new_password)
     kit_counts = ag_data.getMapMarkers()
     tl = text_locale['handlers']
     MESSAGE = tl['CHANGE_PASS_BODY'] % supplied_kit_id
     try:
         send_email(MESSAGE, tl['CHANGE_PASS_SUBJECT'], email)
         # result=4 is for showing message in if statement of
         # change_pass_verify.html
         self.render('change_pass_verify.html', email='', kitid='',
                     passocde='', new_password='',
                     confirm_password='', result=4, message='',
                     kit_counts=kit_counts, loginerror='')
     except BaseException:
         # result=5 is for showing message in if statement of
         # change_pass_verify.html
         self.render('change_pass_verify.html', email='', kitid='',
                     passocde='', new_password='',
                     confirm_password='', result=5, message='',
                     kit_counts=kit_counts, loginerror='')
Exemple #15
0
    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)
Exemple #17
0
    def post(self):
        # Check handout
        skid = self.get_argument("kit_id").strip()
        password = self.get_argument("password")

        is_handout = ag_data.handoutCheck(skid, password)
        if not is_handout:
            kit_counts = ag_data.getMapMarkers()
            countries = ag_data.get_countries()
            entries = {
                'kit_id': self.get_argument('kit_id'),
                'email': self.get_argument('email'),
                'email2': self.get_argument('email2'),
                'participantname': self.get_argument('participantname'),
                'address': self.get_argument('address'),
                'city': self.get_argument('city'),
                'state': self.get_argument('state'),
                'zip': self.get_argument('zip'),
                'country': self.get_argument('country')
            }
            self.render("register_user.html",
                        kit_counts=kit_counts,
                        loginerror='',
                        countries=countries,
                        entries=entries)
            return

        # Register handout
        tl = text_locale['handlers']
        info = {
            "email": self.get_argument("email"),
            "participantname": self.get_argument("participantname")
        }
        for info_column in ("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.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
        success = ag_data.registerHandoutKit(ag_login_id, skid)
        if not success:
            self.redirect(media_locale['SITEBASE'] + '/db_error/?err=regkit')
            return

        # log user in since registered successfully
        self.set_current_user(skid)
        self.redirect(media_locale['SITEBASE'] + "/authed/portal/")

        kitinfo = ag_data.getAGKitDetails(skid)

        # Email the verification code
        # send email after redirect since it takes so long
        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)
        try:
            send_email(body,
                       subject,
                       recipient=info['email'],
                       sender=media_locale['HELP_EMAIL'])
        except BaseException:
            logging.exception('Error on skid %s:' % skid)
 def get(self):
     latlong_db = ag_data.getMapMarkers()
     countries = ag_data.get_countries()
     self.render("register_user.html",
                 latlongs_db=latlong_db, loginerror='', countries=countries)
Exemple #19
0
 def get(self):
     kit_counts = ag_data.getMapMarkers()
     loginerror = self.get_argument("loginerror", "")
     self.render("index.html", kit_counts=kit_counts, loginerror=loginerror)
    def post(self):
        # Check handout
        skid = self.get_argument("kit_id").strip()
        password = self.get_argument("password")

        is_handout = ag_data.handoutCheck(skid, password)
        if not is_handout:
            kit_counts = ag_data.getMapMarkers()
            countries = ag_data.get_countries()
            entries = {'kit_id': self.get_argument('kit_id'),
                       'email': self.get_argument('email'),
                       'email2': self.get_argument('email2'),
                       'participantname': self.get_argument('participantname'),
                       'address': self.get_argument('address'),
                       'city': self.get_argument('city'),
                       'state': self.get_argument('state'),
                       'zip': self.get_argument('zip'),
                       'country': self.get_argument('country')}
            self.render("register_user.html", kit_counts=kit_counts,
                        loginerror='', countries=countries, entries=entries)
            return

        # Register handout
        tl = text_locale['handlers']
        info = {
            "email": self.get_argument("email"),
            "participantname": self.get_argument("participantname")
        }
        for info_column in ("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.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
        success = ag_data.registerHandoutKit(ag_login_id, skid)
        if not success:
            self.redirect(media_locale['SITEBASE'] + '/db_error/?err=regkit')
            return

        # log user in since registered successfully
        self.set_current_user(skid)
        self.redirect(media_locale['SITEBASE'] + "/authed/portal/")

        kitinfo = ag_data.getAGKitDetails(skid)

        # Email the verification code
        # send email after redirect since it takes so long
        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)
        try:
            send_email(body, subject, recipient=info['email'],
                       sender=media_locale['HELP_EMAIL'])
        except BaseException:
            logging.exception('Error on skid %s:' % skid)
Exemple #21
0
 def get(self):
     kit_counts = ag_data.getMapMarkers()
     self.render('retrieve_kitid.html', message='', output='form',
                 loginerror='', kit_counts=kit_counts)
 def get(self):
     kit_counts = ag_data.getMapMarkers()
     self.render("retrieve_kitid.html", message="", output="form", loginerror="", kit_counts=kit_counts)
 def get(self):
     kit_counts = ag_data.getMapMarkers()
     loginerror = self.get_argument("loginerror", "")
     self.render("index.html", kit_counts=kit_counts,
                 loginerror=loginerror)
 def get(self):
     latlong_db = ag_data.getMapMarkers()
     loginerror = self.get_argument("loginerror", "")
     self.render("index.html", latlongs_db=latlong_db,
                 loginerror=loginerror)