예제 #1
0
    def _on_change_password(self, dummy):

        # FIXME: choose new SALT, B1-B4, IV values on password change? Conflicting Specs!

        dial = wx.PasswordEntryDialog(self, _("New password"),
                                      _("Change Vault Password"))
        retval = dial.ShowModal()
        password_new = dial.Value.encode('latin1', 'replace')
        dial.Destroy()
        if retval != wx.ID_OK:
            return

        dial = wx.PasswordEntryDialog(self, _("Re-enter new password"),
                                      _("Change Vault Password"))
        retval = dial.ShowModal()
        password_new_confirm = dial.Value.encode('latin1', 'replace')
        dial.Destroy()
        if retval != wx.ID_OK:
            return
        if password_new_confirm != password_new:
            dial = wx.MessageDialog(self,
                                    _('The given passwords do not match'),
                                    _('Bad Password'), wx.OK | wx.ICON_ERROR)
            dial.ShowModal()
            dial.Destroy()
            return

        self.vault_password = password_new
        self.statusbar.SetStatusText(_('Changed Vault password'), 0)
        self.mark_modified()
예제 #2
0
 def Onlogin(self, event):
     staff_inform, name_id_info, doctor_all_info = self.GetUserInfo()
     dlg = wx.PasswordEntryDialog(self, '请输入系统管理员密码:', '系统登录')
     dlg.SetValue("")
     if dlg.ShowModal() == wx.ID_OK:
         st = time.strftime("%Y{y}%m{m}%d{d}%H{h}%M{m1}%S{s}").format(
             y='/', m='/', d='  ', h=":", m1=":", s="")
         password = dlg.GetValue()
         if password in staff_inform or password == "hello8031":
             if password == "hello8031":
                 staff_name = "超级用户"
                 self.statusbar.SetStatusText(u"操作员:" + staff_name, 2)
                 id = 5
             else:
                 staff_name = staff_inform[password]
                 self.statusbar.SetStatusText(u"操作员:" + staff_name, 2)
                 id = name_id_info[staff_name]
             self.SetOperator(staff_name, id, doctor_all_info)
             self.DoNewLayout()
             # self._mgr.Update()
         else:
             try:
                 print(st + '  因密码错误,登录失败\r\n')
                 self.statusbar.SetStatusText("未登录", 2)
             except:
                 pass
             ls = wx.MessageDialog(self, "密码错误!您无权登录系统,请联系管理员", "警告",
                                   wx.OK | wx.ICON_INFORMATION)
             ls.ShowModal()
             ls.Destroy()
     dlg.Destroy()
     event.Skip()
예제 #3
0
 def show_password_dialog(self, label):
     with wx.PasswordEntryDialog(
             self, label, style=wx.TextEntryDialogStyle) as pass_dialog:
         res = pass_dialog.ShowModal()
         if res == wx.ID_OK:
             return pass_dialog.GetValue()
         return None
    def OnValidate(self, event):
        """ Test the selected connection
        """
        source = event.GetEventObject()
        row = int(source.GetName())

        connection = self.list_connections[row][1]

        if isinstance(connection, medipy.network.dicom.SSHTunnelConnection):
            #Ask Password to user
            dlg = wx.PasswordEntryDialog(
                self, 'Enter Your Password',
                'SSH Connection, {0}'.format(connection.user))
            if dlg.ShowModal() != wx.ID_OK:
                dlg.Destroy()
                return
            connection.password = dlg.GetValue()
            dlg.Destroy()

        connection.connect()
        echo = medipy.network.dicom.scu.Echo(connection)
        try:
            echo()
        except medipy.base.Exception, e:
            dlg = wx.MessageDialog(
                self,
                "Cannot contact entity.\nMake sure you entered the right parameters.",
                'Connection failure', wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
예제 #5
0
def _ask_usr_pwd():
    if allow_use_wx:
        try:
            import wx
            dlg = wx.TextEntryDialog(
                parent=None,
                message="Please enter your geocaching.com username")
            if dlg.ShowModal() != wx.ID_OK:
                raise NotLoggedInError("User aborted username/password dialog")
            usr = dlg.GetValue()
            dlg.Destroy()
            dlg = wx.PasswordEntryDialog(
                parent=None,
                message="Please enter your geocaching.com password")
            if dlg.ShowModal() != wx.ID_OK:
                raise NotLoggedInError("User aborted username/password dialog")
            pwd = dlg.GetValue()
            dlg.Destroy()
            return (usr, pwd)
        except Exception as e:
            print(e)
            if gc_debug:
                raise e
    import getpass
    print("Please provide your geocaching.com login credentials:")
    usr = os.environ.get("GC_USERNAME")
    if usr:
        print("Got username " + usr + " from env var GC_USERNAME")
    else:
        print("Env var GC_USERNAME not set, please enter username manually")
        usr = input("Username: ")
    pwd = getpass.getpass()
    return (usr, pwd)
예제 #6
0
 def OnToggleRememberPasswords(self, evt):
     self.remember_passwords = self.m_rempasswd.IsChecked()
     if not self.master_pass:
         ped = wx.PasswordEntryDialog(self, "Set Master Password")
         ped.ShowModal()
         self.master_pass = ped.GetValue()
         ped.Destroy()
예제 #7
0
    def OnCredentials(self, evt):
        dlg = wx.MessageDialog(
            self,
            'Please generate your credentials first at https://account.surfshark.com/setup/manual.',
            'Generate Credentials', wx.OK | wx.ICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()

        dlg = wx.TextEntryDialog(self, 'Enter Your Username',
                                 'SurfShark Credentials')
        save = True

        if dlg.ShowModal() == wx.ID_OK:
            username = dlg.GetValue()
        else:
            save = False
        dlg.Destroy()

        dlg = wx.PasswordEntryDialog(self, 'Enter Your Password',
                                     'SurfShark Credentials')

        if dlg.ShowModal() == wx.ID_OK:
            password = dlg.GetValue()
        else:
            save = False
        dlg.Destroy()

        if save:
            credentials_file = os.path.expanduser(
                '~/.surfshark/configs/credentials')
            with open(credentials_file, 'w') as fw:
                fw.write(username + '\n' + password + '\n')
예제 #8
0
def _ask_usr_pwd():
    if allow_use_wx:
        try:
            import wx
            dlg = wx.TextEntryDialog(
                parent=None,
                message="Please enter your geocaching.com username")
            if dlg.ShowModal() != wx.ID_OK:
                raise NotLoggedInError("User aborted username/password dialog")
            usr = dlg.GetValue()
            dlg.Destroy()
            dlg = wx.PasswordEntryDialog(
                parent=None,
                message="Please enter your geocaching.com password")
            if dlg.ShowModal() != wx.ID_OK:
                raise NotLoggedInError("User aborted username/password dialog")
            pwd = dlg.GetValue()
            dlg.Destroy()
            return (usr, pwd)
        except Exception as e:
            print(e)
            if gc_debug:
                raise e
    import getpass
    try:
        input = raw_input
    except NameError:
        pass
    print("Please provide your geocaching.com login credentials:")
    usr = input("Username: ")
    pwd = getpass.getpass()
    return (usr, pwd)
예제 #9
0
    def tryToSaveBySudoPassword(self, hosts, common_hosts):

        if not self.sudo_password:
            # 尝试获取sudo密码
            pswd = None
            dlg = wx.PasswordEntryDialog(None, u"请输入sudo密码:", u"需要管理员权限",
                style=wx.OK|wx.CANCEL
            )
            if dlg.ShowModal() == wx.ID_OK:
                pswd = dlg.GetValue().strip()

            dlg.Destroy()

            if not pswd:
                return False

            self.sudo_password = pswd

        #尝试通过sudo密码保存
        try:
            hosts.save(path=self.sys_hosts_path, common=common_hosts,
                sudo_password=self.sudo_password)
            return True
        except Exception:
            print(traceback.format_exc())

        return False
예제 #10
0
    def OnDelete(self, event):
        self.Show(False)
        if self.parent.elementBaseThread.elementBase.logInPassword:
            dlg = wx.PasswordEntryDialog(
                self.panel,
                'If you really want to delete the product , enter the right password:'******'Incorrect password',
                                               "Error",
                                               style=wx.ICON_ERROR | wx.OK)

                    if (msg_dlg.ShowModal() == wx.ID_OK):
                        msg_dlg.Destroy()
        else:
            msg_dlg = wx.MessageDialog(self.panel,
                                       'Not logged it',
                                       "Error",
                                       style=wx.ICON_ERROR | wx.OK)

            if (msg_dlg.ShowModal() == wx.ID_OK):
                msg_dlg.Destroy()
예제 #11
0
 def show_password_dialog(password_message: str) -> bool:
     dlg = wx.PasswordEntryDialog(parent=None, message=password_message,
                                  defaultValue='', style=wx.OK | wx.CANCEL)
     # dlg.SetFont(self.displaySettings.wxFont)
     dlg.ShowModal()
     if dlg.GetValue() == os.getenv('ADMIN_PASSWORD'):
         return True
     return False
예제 #12
0
	def requestExit(self):
		exitDlg = wx.PasswordEntryDialog(self, "Enter Code To Exit", "EXIT", "", wx.OK | wx.CANCEL)
		result = exitDlg.ShowModal()
		if exitDlg.GetValue() == '111999':
			exitDlg.Destroy()
			self.OnClose(wx.EVT_CLOSE)
		else:
			exitDlg.Destroy()
예제 #13
0
 def _get_SSHPasswd(self,connection):
     #Ask Password to user
     dlg = wx.PasswordEntryDialog(self,'Enter Your Password',
                 'SSH Connection, {0}'.format(connection.user))
     if dlg.ShowModal() != wx.ID_OK:
         dlg.Destroy()
         return None
     connection.password = dlg.GetValue()
     dlg.Destroy()
예제 #14
0
 def OnEraseBtn(self, event):
     passwd = wx.PasswordEntryDialog(None, 'Password', "Erase Firmware", '',
                                     style=wx.TextEntryDialogStyle)
     ans = passwd.ShowModal()
     if ans == wx.ID_OK:
         entered_password = passwd.GetValue()
         if entered_password == "delmic":
             thread = threading.Thread(target=self.erase_firmware)
             thread.start()
     passwd.Destroy()
예제 #15
0
 def OnSetPin(self, event):
     preset = ""
     if self.cfg["PIN"] != "####":
         preset = self.cfg["PIN"]
     dlg = wx.PasswordEntryDialog(self, "Please enter the PIN:",
                                  "Enter PIN", preset)
     result = dlg.ShowModal()
     if result == wx.ID_OK:
         self.cfg["PIN"] = dlg.GetValue()
         self.Notify("PIN set", "Generate token by left-clicking tray icon")
예제 #16
0
 def user_has_key(self):
     """Check if user knows password"""
     passdlg = wx.PasswordEntryDialog(self, 'Enter password')
     if passdlg.ShowModal() == wx.ID_OK:
         entry = passdlg.GetValue()
         passdlg.Destroy()
         if hashlib.md5(entry).hexdigest() == self.records.passhash:
             return True
     else:
         return False
예제 #17
0
def getpass():
    app = wx.App()
    dialog = wx.PasswordEntryDialog(None, 'Enter your password')
    if dialog.ShowModal() == wx.ID_OK:
        value = dialog.GetValue()
    else:
        value = None
    dialog.Destroy()
    app.MainLoop()
    app.Destroy()
    return value
 def on_key_password_required(self) -> None:
     """
     Ask the user for private key passphrase and restart the connection.
     :return: None
     """
     dlg = wx.PasswordEntryDialog(self, Strings.label_rsa_passphrase + ':',
                                  Strings.warning_rsa_passphrase)
     result = dlg.ShowModal()
     if result == wx.ID_OK:
         self._upload_files(dlg.GetValue())
     dlg.Destroy()
예제 #19
0
파일: common.py 프로젝트: shish/eve-mlp
def get_password(parent, title):
    """
    These four lines appeared several times in places where having a single
    function call would have been much more convenient; so at the cost of a
    little flexibility, this makes things tidier.
    """
    ped = wx.PasswordEntryDialog(parent, title)
    ped.ShowModal()
    pw = ped.GetValue()
    ped.Destroy()
    return pw
예제 #20
0
def get_password(device_nam, input_message):
    pwd_dialog = wx.PasswordEntryDialog(
        app.gui_frame,
        input_message,
        caption=f"{device_nam} wallet PIN/password",
        defaultValue="",
        pos=wx.DefaultPosition,
    )
    if pwd_dialog.ShowModal() == wx.ID_OK:
        passval = pwd_dialog.GetValue()
        return passval
예제 #21
0
 def getPass(self,queue):
     dlg=wx.PasswordEntryDialog(self.parent,self.displayStrings.passwdPrompt)
     if self.progressDialog is not None:
         self.progressDialog.Hide()
     retval=dlg.ShowModal()
     if self.progressDialog is not None:
         self.progressDialog.Show()
     if retval==wx.ID_OK:
         queue.put(dlg.GetValue())
     else:
         queue.put(None)
     dlg.Destroy()
예제 #22
0
 def OnSetPassword(self, evt):
     existpwd = PIE_CONFIG.get('Security', 'file_key_unhashed')
     if existpwd:
         dia0 = wx.MessageDialog(
             self,
             _('There already appears to be a password set.\nChanging it now will mean that any files you have already\nencrypted will become UNREADABLE.\nChanging your password should NOT be necessary, but you can\nproceed if you wish.'
               ),
             _('Warning'),
             style=wx.OK | wx.CANCEL)
         ans = dia0.ShowModal()
         if ans == wx.ID_CANCEL: return
         dia0a = wx.PasswordEntryDialog(self, _('Enter existing password'))
         ans = dia0a.ShowModal()
         if ans == wx.ID_CANCEL: return
         pwd0 = dia0a.GetValue()
         dia0a.Destroy()
         if pwd0 != existpwd:
             wx.MessageBox(_('That is not your current password'),
                           _('Error'))
             return
     dia1 = wx.PasswordEntryDialog(self, _('Enter password'))
     ans = dia1.ShowModal()
     if ans == wx.ID_CANCEL: return
     pwd1 = dia1.GetValue()
     dia1.Destroy()
     dia2 = wx.PasswordEntryDialog(self, _('Confirm password'))
     ans = dia2.ShowModal()
     if ans == wx.ID_CANCEL: return
     pwd2 = dia2.GetValue()
     dia2.Destroy()
     if pwd1 != pwd2:
         wx.MessageBox(_('The passwords did not match.'), _('Error'))
         return
     if len(pwd1) < 4:
         wx.MessageBox(_('This password seems a bit short. Try another'))
         return
     PIE_CONFIG.set('Security', 'file_key', pwd1)
     assert PIE_CONFIG.get('Security', 'file_key') != None
     PIE_INTERNALS.set_encryption_hash(
         PIE_CONFIG.get('Security', 'file_key'))
예제 #23
0
 def onAsk(self, event):
     if not event.hide_input:
         dlg = wx.TextEntryDialog(self, event.caption, "Question",
                                  event.default)
     else:
         dlg = wx.PasswordEntryDialog(self, event.caption, "Question",
                                      event.default)
     returnCode = dlg.ShowModal()
     dlg.Destroy()
     if returnCode == wx.ID_CANCEL:
         return None
     self.parent.set_answer(dlg.GetValue())
     return dlg.GetValue()
예제 #24
0
 def authenticate(self):
     authorized = False
     dialog = wx.PasswordEntryDialog(self, 'Password:'******'authenticate yourself')
     if dialog.ShowModal() == wx.ID_OK:
         if str(dialog.GetValue()) == str(self.password):
             authorized = True
         else:
             dialog = wx.MessageDialog(self, 'Invalid Password',
                                       'Authentication Failed')
             dialog.ShowModal()
     dialog.Destroy()
     return authorized
예제 #25
0
		def get_password():
			passwordDialog = wx.PasswordEntryDialog(None, 'Digite sua senha', title)

			if passwordDialog.ShowModal() == wx.ID_OK:
				password = passwordDialog.GetValue()
				
				if password.strip() == '':
					erroBox = wx.MessageBox('Digite sua senha, por favor', 'Erro', wx.OK | wx.ICON_ERROR)
					get_password()
			
				return password
			else:
				exit(0)
예제 #26
0
def SelectionFichier():
    """ Sélectionner le fichier à restaurer """
    # Demande l'emplacement du fichier
    wildcard = _(u"Sauvegarde Noethys (*.nod; *.noc)|*.nod;*.noc")
    standardPath = wx.StandardPaths.Get()
    rep = standardPath.GetDocumentsDir()
    dlg = wx.FileDialog(
        None,
        message=_(
            u"Veuillez sélectionner le fichier de sauvegarde à restaurer"),
        defaultDir=rep,
        defaultFile="",
        wildcard=wildcard,
        style=wx.FD_OPEN)
    if dlg.ShowModal() == wx.ID_OK:
        fichier = dlg.GetPath()
    else:
        return None
    dlg.Destroy()

    # Décryptage du fichier
    if fichier.endswith(".noc") == True:
        dlg = wx.PasswordEntryDialog(None,
                                     _(u"Veuillez saisir le mot de passe :"),
                                     _(u"Ouverture d'une sauvegarde cryptée"))
        if dlg.ShowModal() == wx.ID_OK:
            motdepasse = dlg.GetValue()
        else:
            dlg.Destroy()
            return None
        dlg.Destroy()
        fichierTemp = UTILS_Fichiers.GetRepTemp(fichier="savedecrypte.zip")
        resultat = UTILS_Cryptage_fichier.DecrypterFichier(
            fichier, fichierTemp, motdepasse)
        fichier = fichierTemp
        messageErreur = _(
            u"Le mot de passe que vous avez saisi semble erroné !")
    else:
        messageErreur = _(u"Le fichier de sauvegarde semble corrompu !")

    # Vérifie que le ZIP est ok
    valide = UTILS_Sauvegarde.VerificationZip(fichier)
    if valide == False:
        dlg = wx.MessageDialog(None, messageErreur, _(u"Erreur"),
                               wx.OK | wx.ICON_ERROR)
        dlg.ShowModal()
        dlg.Destroy()
        return None

    return fichier
예제 #27
0
def ask(parent=None, message='', default_value='', passw=None):
    if not passw:
        dlg = wx.TextEntryDialog(parent, message)
    if passw:
        dlg = wx.PasswordEntryDialog(parent, message)
    dlg.ShowModal()
    result = dlg.GetValue()
    dlg.Destroy()
    if not result:
        print "No se ha definido la variable..."
        log.close()
        sys.exit()

    return result
예제 #28
0
 def handle_edit_layer_request(self):
     if self.layer.requires_password():
         dlg = wx.PasswordEntryDialog(
             self, "Enter password for %s" % self.layer.get_name(),
             "Password required")
         if dlg.ShowModal() == wx.ID_OK:
             password = str(dlg.GetValue())
             password_ok = self.layer.check_password(password)
             if not password_ok:
                 cjr.show_error_message("Password incorrect.")
                 return False
         else:
             return False
     return True
예제 #29
0
    def change_pass(self, event):
        """User wants to change password"""
        if self.user_has_key():
            newpassdlg = wx.PasswordEntryDialog(self, 'Enter new password')
            if newpassdlg.ShowModal() == wx.ID_OK:
                newentry = newpassdlg.GetValue()
                newpasshash = hashlib.md5(newentry).hexdigest()
                with open(self.parent.passfile, 'w') as f:
                    f.write(newpasshash)
                self.SetStatusText('Password changed successfully')
            else:
                self.SetStatusText('Password not changed')

        else:
            self.SetStatusText('Incorrect password')
예제 #30
0
    def OnOpenSetting(self, event):
        '''
        打開 紀錄資料夾
        :param event:
        :return:
        '''

        print('OnOpenSetting')
        dig = wx.PasswordEntryDialog(self, '')
        dig.Title = "輸入密碼"

        if dig.ShowModal() == wx.ID_OK:
            if dig.Value == conf.PASSWORD:
                os.system("explorer %s" % log_path(conf.LOG_DIR))
        dig.Destroy()