예제 #1
0
 def f():
     """Inner function that will be run in a thread."""
     token_name = get_token_name(app_name)
     logger.debug('login: token_name %r, email %r, password <hidden>.',
                  token_name, email)
     credentials = self.processor.login(email, password, token_name)
     logger.debug('login returned not None credentials? %r.',
                  credentials is not None)
     return credentials
예제 #2
0
 def validate_email(self, app_name, email, password, email_token,
                    ping_url=None):
     """Call the matching method in the processor."""
     try:
         token_name = get_token_name(app_name)
         credentials = yield self.processor.validate_email(email, password,
                                                   email_token, token_name)
         yield self._process_new_token(app_name, email,
                                       credentials, ping_url)
         self.EmailValidated(app_name, email)
     except Exception as e:
         self.EmailValidationError(app_name, e)
예제 #3
0
 def validate_email(self,
                    app_name,
                    email,
                    password,
                    email_token,
                    ping_url=None):
     """Call the matching method in the processor."""
     try:
         token_name = get_token_name(app_name)
         credentials = yield self.processor.validate_email(
             email, password, email_token, token_name)
         yield self._process_new_token(app_name, email, credentials,
                                       ping_url)
         self.EmailValidated(app_name, email)
     except Exception as e:
         self.EmailValidationError(app_name, e)
예제 #4
0
 def login(self, app_name, email, password, ping_url=None):
     """Call the matching method in the processor."""
     try:
         token_name = get_token_name(app_name)
         logger.debug('login: token_name %r, email %r, password <hidden>.',
                      token_name, email)
         credentials = yield self.processor.login(email, password,
                                                  token_name)
         logger.debug('login returned not None credentials? %r.',
                      credentials is not None)
         is_validated = yield self.processor.is_validated(credentials)
         logger.debug('user is validated? %r.', is_validated)
         if is_validated:
             yield self._process_new_token(app_name, email,
                                           credentials, ping_url)
             self.LoggedIn(app_name, email)
         else:
             self.UserNotValidated(app_name, email)
     except Exception as e:
         self.LoginError(app_name, e)
예제 #5
0
 def login(self, app_name, email, password, ping_url=None):
     """Call the matching method in the processor."""
     try:
         token_name = get_token_name(app_name)
         logger.debug('login: token_name %r, email %r, password <hidden>.',
                      token_name, email)
         credentials = yield self.processor.login(email, password,
                                                  token_name)
         logger.debug('login returned not None credentials? %r.',
                      credentials is not None)
         is_validated = yield self.processor.is_validated(credentials)
         logger.debug('user is validated? %r.', is_validated)
         if is_validated:
             yield self._process_new_token(app_name, email, credentials,
                                           ping_url)
             self.LoggedIn(app_name, email)
         else:
             self.UserNotValidated(app_name, email)
     except Exception as e:
         self.LoginError(app_name, e)
예제 #6
0
 def _get_keyring_attr(self, app_name):
     """Build the keyring attributes for this credentials."""
     attr = {"key-type": "Ubuntu SSO credentials",
             "token-name": get_token_name(app_name)}
     return attr
예제 #7
0
 def f():
     """Inner function that will be run in a thread."""
     token_name = get_token_name(app_name)
     credentials = self.processor.validate_email(email, password,
                                               email_token, token_name)
     return credentials