return False
def authMifareCard(self, cardId):
+ self._loggedIn = False
+ self._username = None
if DISPSRV_MIFARE:
card_base64 = base64.b64encode(cardId)
sockf.write("AUTHCARD %s\n" % (card_base64,)); sockf.flush()
rsp = sockf.readline()
if not "200" in rsp:
- raise ValueError, "no UID found for card ID"
+ return False
username = rsp.split('=')[1].strip()
# Check for thier username
sockf.write("AUTHIDENT\n")
sockf.flush(); rsp = sockf.readline()
assert "200" in rsp
- sockf.write("SETEUSER %s\n", self._username)
+ sockf.write("SETEUSER %s\n" % (self._username,))
sockf.flush(); rsp = sockf.readline()
assert "200" in rsp
- sockf.write("CARD_ADD %s\n", card_base64)
+ sockf.write("CARD_ADD %s\n" % (card_base64,))
sockf.flush(); rsp = sockf.readline()
if "200" in rsp:
return True
#!/usr/bin/python
-# vim:ts=4
+# vim: ts=4 sts=4 sw=4 noexpandtab
USE_MIFARE = 1
if len(self.vstatus.cur_pin) == PIN_LENGTH:
self.dispense.authUserIdPin(self.vstatus.cur_user, self.vstatus.cur_pin)
if self.dispense.getUsername():
+ self.vstatus.username = self.dispense.getUsername()
self.v.beep(0, False)
self.vstatus.cur_selection = ''
self.vstatus.change_state(STATE_GET_SELECTION)