Skip to content

Commit 9f677ad

Browse files
author
Rafael Fernandes
committed
Correcting the automatic startup configuration screen.
1 parent b07cfcb commit 9f677ad

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

addon/globalPlugins/remoteClient/dialogs.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,16 @@ def onSave(self):
383383
elif self.client_or_server.GetSelection() and not self.port.GetValue() or not self.key.GetValue():
384384
gui.messageBox(_("Both port and key must be set."), _("Error"), wx.OK | wx.ICON_ERROR)
385385
raise
386+
if len(self.key.GetValue()) < 6:
387+
# Translators: error message for key/password length less than 6 characters
388+
gui.messageBox(_("The key must be longer than 6 characters."), _("Error"), wx.OK | wx.ICON_ERROR)
389+
self.key.SetFocus()
390+
raise
391+
elif self.is_sequential(self.key.GetValue()):
392+
# Translators: error message for key/password being sequential, example 123456
393+
gui.messageBox(_("The key must not be sequential."), _("Error"), wx.OK | wx.ICON_ERROR)
394+
self.key.SetFocus()
395+
raise
386396
NVDAConfig.conf.profiles[-1].name = self.originalProfileName
387397
config = configuration.get_config()
388398
cs = config['controlserver']
@@ -405,6 +415,14 @@ def onSave(self):
405415
config['ui']['portcheck'] = self.portcheck.GetValue()
406416
config.write()
407417

418+
def is_sequential(self, password):
419+
if len(password) < 3:
420+
return False
421+
for i in range(len(password) - 2):
422+
if ord(password[i]) == ord(password[i + 1]) - 1 == ord(password[i + 2]) - 2:
423+
return True
424+
return False
425+
408426
class CertificateUnauthorizedDialog(wx.MessageDialog):
409427

410428
def __init__(self, parent, fingerprint=None):

0 commit comments

Comments
 (0)