Digits are now shown in plain text for 750ms before they are obfuscated
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@216 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -419,11 +419,25 @@ class PinpadGTK:
|
|||||||
"""We indicate the ammount of digits with underscores
|
"""We indicate the ammount of digits with underscores
|
||||||
For every digit that is enterd we replace one underscore with a star
|
For every digit that is enterd we replace one underscore with a star
|
||||||
We only accept secret_len digits and ignore every additional digit"""
|
We only accept secret_len digits and ignore every additional digit"""
|
||||||
c = widget.get_label()
|
digit = widget.get_label()
|
||||||
|
assert digit.isdigit()
|
||||||
txt = self.output.get_text()
|
txt = self.output.get_text()
|
||||||
if len(self.pin) < self.secret_len:
|
if len(self.pin) < self.secret_len:
|
||||||
self.output.set_text(txt.replace("_", "*", 1))
|
# self.output.set_text(txt.replace("_", digit, 1))
|
||||||
self.pin += widget.get_label()
|
idx = txt.find('_')
|
||||||
|
output = txt[:idx] + digit + txt[idx+1:]
|
||||||
|
self.output.set_text(output)
|
||||||
|
gobject.timeout_add(750, self.hide_digits, idx)
|
||||||
|
self.pin += digit
|
||||||
|
|
||||||
|
def hide_digits(self, idx):
|
||||||
|
"""Change character number idx of self.output text to a '*' """
|
||||||
|
output = ""
|
||||||
|
txt = self.output.get_text()
|
||||||
|
if txt[idx].isdigit():
|
||||||
|
output = txt[:idx] + '*' + txt[idx+1:]
|
||||||
|
self.output.set_text(output)
|
||||||
|
return False
|
||||||
|
|
||||||
def btnOk_clicked(self, widget):
|
def btnOk_clicked(self, widget):
|
||||||
|
|
||||||
@@ -519,9 +533,9 @@ class PinpadGTK:
|
|||||||
"""Remove one digit from the pin and replace the last * in the output
|
"""Remove one digit from the pin and replace the last * in the output
|
||||||
field with an underscore"""
|
field with an underscore"""
|
||||||
self.pin = self.pin[:-1]
|
self.pin = self.pin[:-1]
|
||||||
txt = self.output.get_text()
|
num_digits = len(self.pin)
|
||||||
idx = txt.rfind("*")
|
output = num_digits * '*' + (self.secret_len - num_digits) * "_"
|
||||||
self.output.set_text(txt[:idx] + "_" + txt[idx + 1:])
|
self.output.set_text(output)
|
||||||
|
|
||||||
class Popup(object):
|
class Popup(object):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user