Example #1
0
 def on_ok(self):
     # Verify Smart Card Available
     if self.ms2.value:
         v = self.ms2.get_selected_objects()[0]
         if v == 'Register':
             if client.askForRegist():
                 if Smartcard.isSmartCardAvailable():
                     self.parentApp.getForm("PIN").destination = "Register"
                     self.parentApp.switchForm("PIN")
                 else:
                     npyscreen.notify_wait("You have no Smartcard connected",
                               title="Failure", form_color="WARNING")
             else:
                 print "ERROR MESSAGE"
         elif v == 'Log In':
             if client.askForLogIn():
                 if Smartcard.isSmartCardAvailable():
                     self.parentApp.getForm("PIN").destination = "Log In"
                     self.parentApp.switchForm("PIN")
                 else:
                     self.parentApp.switchForm("Log In")
             else:
                 print "ERROR MESSAGE"
         else:
             npyscreen.notify_wait(
                 "Project Safebox - Security UA\n\n-> José Sequeira 64645\n"
                 + "-> Vasco Santos 64191", title='Project Info',
                 form_color='CRITICAL')
Example #2
0
 def beforeEditing(self):
     self.name = "New User"
     # Give CC Username
     card = Smartcard.Smartcard(self.pin.value)
     if Smartcard.isSmartCardAvailable():
         self.wgUsername.value, self.bi.value = client.readCC(card)
         self.bi.editable = False
     else:
         self.bi.value = ''
         self.bi.editable = True
         self.wgUsername.hidden = True
         self.pin.hidden = True
     self.wgUsername.editable = False
     self.wgPass1.value = ''