def on_rename_profile(self, profile_id): prfl = profile.Profile.get_profile(profile_id) dialog = interface.InputDialog() dialog.set_title(APP_NAME_FORMATED) dialog.set_icon(utils.get_logo()) dialog.set_message('Rename Profile') dialog.set_message_secondary('Enter new name for profile %s' % ( prfl.name)) dialog.set_input_label('Profile Name:') dialog.set_input_width(32) response = dialog.run() if response is not None: prfl.set_name(response[:32]) self.update_menu() dialog.destroy()
def show_import_profile_uri(self): dialog = interface.InputDialog() dialog.set_title('%s - Import Profile URI' % APP_NAME_FORMATED) dialog.set_icon(utils.get_logo()) dialog.set_message('Import Profile URI') dialog.set_message_secondary('Enter profile URI to import...') dialog.set_input_label('Profile URI:') dialog.set_input_width(32) response = dialog.run() if response: try: profile.import_uri(response) except Exception as exception: self.show_import_profile_error(exception) self.update_menu() dialog.destroy()
def on_connect_profile(self, profile_id): passwd = None prfl = profile.Profile.get_profile(profile_id) if prfl.status in ACTIVE_STATES: return prfl.sync_conf() if prfl.auth_passwd: dialog = interface.InputDialog() dialog.set_title(APP_NAME_FORMATED) dialog.set_icon(utils.get_logo()) dialog.set_message('Profile Authenticator Required') dialog.set_message_secondary('Enter authenticator key for %s' % (prfl.name)) dialog.set_input_label('Authenticator Key:') dialog.set_input_width(16) passwd = dialog.run() dialog.destroy() if passwd is None: return dialog = interface.MessageDialog() dialog.set_type(MESSAGE_LOADING) dialog.set_buttons(BUTTONS_CANCEL) dialog.set_title(APP_NAME_FORMATED) dialog.set_icon(utils.get_logo()) dialog.set_message('Connecting to %s' % prfl.name) dialog.set_message_secondary('Conecting to the server...') def connect_callback(): dialog.close() threading.Thread(target=prfl.start, args=(self.on_status_change, connect_callback, passwd)).start() response = dialog.run() dialog.destroy() if response is False: threading.Thread(target=prfl.stop).start() return if prfl.status in ERROR_STATES: self.show_connect_error(prfl, prfl.status)
def on_connect_profile(self, profile_id): passwd = None prfl = profile.Profile.get_profile(profile_id) if prfl.status in ACTIVE_STATES: return prfl.sync_conf() auth_type = prfl.auth_type if auth_type: passwd = '' if 'password' in auth_type: dialog = interface.InputDialog() dialog.set_title(APP_NAME_FORMATED) dialog.set_icon(utils.get_logo()) dialog.set_message('Profile Password Required') dialog.set_message_secondary('Enter password for %s' % ( prfl.name)) dialog.set_input_label('Password:'******'pin' in auth_type: dialog = interface.InputDialog() dialog.set_title(APP_NAME_FORMATED) dialog.set_icon(utils.get_logo()) dialog.set_message('Profile Pin Required') dialog.set_message_secondary('Enter pin for %s' % ( prfl.name)) dialog.set_input_label('Pin:') dialog.set_input_width(16) dialog.set_visibility(False) resp = dialog.run() dialog.destroy() if resp is None: return else: passwd += resp if 'duo' in auth_type: dialog = interface.InputDialog() dialog.set_title(APP_NAME_FORMATED) dialog.set_icon(utils.get_logo()) dialog.set_message('Profile Duo Passcode Required') dialog.set_message_secondary( 'Enter Duo passcode for %s' % (prfl.name)) dialog.set_input_label('Duo Passcode:') dialog.set_input_width(16) resp = dialog.run() dialog.destroy() if resp is None: return else: passwd += resp elif 'yubikey' in auth_type: dialog = interface.InputDialog() dialog.set_title(APP_NAME_FORMATED) dialog.set_icon(utils.get_logo()) dialog.set_message('Profile YubiKey Required') dialog.set_message_secondary( 'Insert YubiKey for %s' % (prfl.name)) dialog.set_input_label('YubiKey:') dialog.set_input_width(16) dialog.set_visibility(False) resp = dialog.run() dialog.destroy() if resp is None: return else: passwd += resp elif 'otp' in auth_type: dialog = interface.InputDialog() dialog.set_title(APP_NAME_FORMATED) dialog.set_icon(utils.get_logo()) dialog.set_message('Profile Authenticator Required') dialog.set_message_secondary( 'Enter authenticator key for %s' % (prfl.name)) dialog.set_input_label('Authenticator Key:') dialog.set_input_width(16) resp = dialog.run() dialog.destroy() if resp is None: return else: passwd += resp if prfl.encrypted: if not self.wait_for_usb_insert(): return prfl.decrypt_vpv_conf() self.wait_for_usb_remove() dialog = interface.MessageDialog() dialog.set_type(MESSAGE_LOADING) dialog.set_buttons(BUTTONS_CANCEL) dialog.set_title(APP_NAME_FORMATED) dialog.set_icon(utils.get_logo()) dialog.set_message('Connecting to %s' % prfl.name) dialog.set_message_secondary('Conecting to the server...') def connect_callback(): dialog.close() threading.Thread(target=prfl.start, args=(self.on_status_change, connect_callback, passwd)).start() response = dialog.run() dialog.destroy() if response is False: threading.Thread(target=prfl.stop).start() return if prfl.status in ERROR_STATES: self.show_connect_error(prfl, prfl.status)