Пример #1
0
    def _set_account_info(self):
        with session_scope() as db_session:
            account = db_session.query(ImapAccount).get(self.account_id)

            # Refresh token if need be, for OAuthed accounts
            if AUTH_TYPES.get(account.provider) == 'oauth':
                self.access_token = account.access_token

            self.email_address = account.email_address
            self.provider = account.provider
Пример #2
0
    def _set_account_info(self):
        with session_scope() as db_session:
            account = db_session.query(ImapAccount).get(self.account_id)

            self.email_address = account.email_address
            self.provider = account.provider
            self.sender_name = account.sender_name
            self.sent_folder = account.sent_folder.name

            self.auth_type = AUTH_TYPES.get(account.provider)

            if self.auth_type == 'oauth':
                self.auth_token = account.access_token
            else:
                assert self.auth_type == 'password'
                self.auth_token = account.password