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'))
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'))
def xball(): if self.FileData_Root: if self.FileData_Root == 'librarydir': return 'yellowball' elif self.FileData_Root == 'projectdir': if self.FileData_FolderAdv: defcon = PIE_INTERNALS.getint( 'Security', 'EncryptAfterSecurityLevel') if self.FileData_FolderAdv.SecurityLevel > defcon: if self.aspects['encrypted'] == EC_TRUE_UNLOCKED: return 'unlocked' elif self.aspects['encrypted'] == EC_TRUE_LOCKED: return 'locked' else: return 'neverlocked' return 'greenball' elif self.FileData_Root == 'meetingpaperdir': return 'redball' else: return 'blueball' else: return 'blueball'