validate confirm password field on every change

This commit is contained in:
Michael Hudson-Doyle 2017-10-05 15:19:29 +13:00
parent 35988f2fd9
commit 8686c0418b
1 changed files with 8 additions and 0 deletions

View File

@ -104,6 +104,7 @@ class IdentityView(BaseView):
self.form = IdentityForm()
connect_signal(self.form, 'submit', self.done)
connect_signal(self.form.confirm_password.widget, 'change', self._check_password)
self.ssh_import_confirmed = True
@ -114,6 +115,13 @@ class IdentityView(BaseView):
]
super().__init__(ListBox(body))
def _check_password(self, sender, new_text):
password = self.form.password.value
if not password.startswith(new_text):
self.form.confirm_password.show_extra(("info_error", "Passwords do not match"))
else:
self.form.confirm_password.show_extra('')
def done(self, result):
cpassword = self.model.encrypt_password(self.form.password.value)
log.debug("*crypted* User input: {} {} {}".format(