move key passwd to config
This commit is contained in:
parent
2775a9a4b9
commit
501577d153
|
@ -14,3 +14,4 @@ secretTable:
|
||||||
INSTANT_ARM: rudess
|
INSTANT_ARM: rudess
|
||||||
LOCK: myung
|
LOCK: myung
|
||||||
INSTANT_LOCK: portnoy
|
INSTANT_LOCK: portnoy
|
||||||
|
keyPasswd: 123456
|
||||||
|
|
|
@ -43,10 +43,14 @@ class KeypadListener:
|
||||||
wrongPassSound = soundLib.soundEffects['wrongPass']
|
wrongPassSound = soundLib.soundEffects['wrongPass']
|
||||||
backspaceSound = soundLib.soundEffects['backspace']
|
backspaceSound = soundLib.soundEffects['backspace']
|
||||||
|
|
||||||
|
if not isinstance(passwd, int):
|
||||||
|
logger.error('KeyPasswd must be int. Check configuration')
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
def checkPasswd(action):
|
def checkPasswd(action):
|
||||||
if self._buf == '':
|
if self._buf == '':
|
||||||
ctrlKeySound.play()
|
ctrlKeySound.play()
|
||||||
elif self._buf == passwd:
|
elif self._buf == str(passwd):
|
||||||
self.resetBuffer()
|
self.resetBuffer()
|
||||||
action()
|
action()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -179,7 +179,7 @@ class StateMachine:
|
||||||
|
|
||||||
self._addManaged(PipeListener(callback=secretCallback, name='secret'))
|
self._addManaged(PipeListener(callback=secretCallback, name='secret'))
|
||||||
|
|
||||||
self._addManaged(KeypadListener(stateMachine=self, passwd='5918462'))
|
self._addManaged(KeypadListener(stateMachine=self, passwd=configFile['keyPasswd']))
|
||||||
|
|
||||||
def startTimer(t, sound):
|
def startTimer(t, sound):
|
||||||
self._timer = _CountdownTimer(t, self.TIMOUT, sound)
|
self._timer = _CountdownTimer(t, self.TIMOUT, sound)
|
||||||
|
|
Loading…
Reference in New Issue