def verifyPassword_(self, alert): username = NSUserName() password = self.passwordField.stringValue() if passwdutil.verifyPassword(username, password): # store username and password and end modal alert authrestart.store_password(password, username=username) code = NSAlertFirstButtonReturn NSApplication.sharedApplication().stopModalWithCode_(code) NSApplication.sharedApplication().endSheet_returnCode_(alert, code) alert.window().orderOut_(None) else: # wrong password, shake the alert window self.shake(alert.window())
def verifyPassword_(self, alert): username = NSUserName() password = self.passwordField.stringValue() if passwdutil.verifyPassword(username, password): # store username and password and end modal alert authrestart.store_password(password, username=username) code = NSAlertFirstButtonReturn NSApplication.sharedApplication().stopModalWithCode_(code) NSApplication.sharedApplication().endSheet_returnCode_( alert, code) alert.window().orderOut_(None) else: # wrong password, shake the alert window self.shake(alert.window())