def login(self, username, password, totp): """ Given a username, password and time based one-time-passcode (TOTP), create a new instance representing the SecureDrop api and authenticate. """ self.api = sdclientapi.API(self.hostname, username, password, totp) self.call_api(self.api.authenticate, self.on_authenticate, self.on_login_timeout)
def login(self, username, password, totp): """ Given a username, password and time based one-time-passcode (TOTP), create a new instance representing the SecureDrop api and authenticate. Default to 60 seconds until we implement a better request timeout strategy. We lower the default_request_timeout for Queue API requests in ApiJobQueue in order to display errors faster. """ storage.mark_all_pending_drafts_as_failed(self.session) self.api = sdclientapi.API( self.hostname, username, password, totp, self.proxy, default_request_timeout=60) self.call_api(self.api.authenticate, self.on_authenticate_success, self.on_authenticate_failure) self.show_last_sync_timer.stop() self.set_status('')