Example #1
0
 def wrapper(environ, name, *args):
     if not valid_email(name):
         new_name = "%s@%s" % (name, self.domain)
         if valid_email(new_name):
             logging.info("Defaulting username %s to %s" % (name, new_name))
             name = new_name
     return f(environ, name, *args)
Example #2
0
    def check_password(self, environ, user, password):
        """
        Authentication handler that checks against Google Accounts (Google Apps / Regular Google Account)
        """
        if not valid_email(user):
            logging.info("Refusing to authenticate against Google for non-email address %s" % (user))
            return None

        service = ContactsService(email=user, password=password)
        try:
            service.ProgrammaticLogin()
        except BadAuthentication:
            logging.warn("Unsuccessful authentication returned by Google for %s" % (user))
            return False
        except CaptchaRequired:
            logging.error("CAPTCHA request returned by Google for %s" % (user))
        except:
            logging.error("Unknown error returned by Google for %s" % (user))
        else:
            logging.info("Successful authentication returned by Google for %s" % (user))
            return True
        return None
Example #3
0
 def wrapper(environ, name, *args):
     if valid_email(name):
         return f(environ, name, *args)
     else:
         logging.info("Ignoring username %s as it is not a valid email")
         return None