Exemple #1
0
def setUserPin(pinId):
    # Prompt the user for the pin
    numberpad = NumberPad.createNumberPad(32106)
    numberpad.doModal()

    # Get the code that the user entered
    enteredPin = numberpad.getPin()
    del numberpad

    # Check to ensure the user has either set no password or one the correct length
    if (len(enteredPin) > 0) and (Settings.getPinLength() > len(enteredPin)):
        log("SetPin: Incorrect length pin entered, expecting %d digits" %
            Settings.getPinLength())
        xbmcgui.Dialog().ok(
            ADDON.getLocalizedString(32001).encode('utf-8'),
            ADDON.getLocalizedString(32109).encode('utf-8'))
    elif Settings.checkUserPinClash(enteredPin, pinId):
        # This pin clashes with an existing pin
        log("SetPin: Entered pin clashes with an existing pin")
        xbmcgui.Dialog().ok(
            ADDON.getLocalizedString(32001).encode('utf-8'),
            ADDON.getLocalizedString(32112).encode('utf-8'))
    else:
        # Now double check the value the user entered
        numberpad = NumberPad.createNumberPad(32107)
        numberpad.doModal()

        # Get the code that the user entered
        enteredPin2 = numberpad.getPin()
        del numberpad

        if enteredPin == enteredPin2:
            Settings.setUserPinValue(enteredPin, pinId)
        else:
            log("SetPin: Pin entry different, first: %s, second %s" %
                (enteredPin, enteredPin2))
            xbmcgui.Dialog().ok(
                ADDON.getLocalizedString(32001).encode('utf-8'),
                ADDON.getLocalizedString(32108).encode('utf-8'))
Exemple #2
0
def setUserPin(pinId):
    # Prompt the user for the pin
    numberpad = NumberPad.createNumberPad(32106)
    numberpad.doModal()

    # Get the code that the user entered
    enteredPin = numberpad.getPin()
    del numberpad

    # Check to ensure the user has either set no password or one the correct length
    if (len(enteredPin) > 0) and (Settings.getPinLength() > len(enteredPin)):
        log("SetPin: Incorrect length pin entered, expecting %d digits" % Settings.getPinLength())
        xbmcgui.Dialog().ok(
            ADDON.getLocalizedString(32001).encode("utf-8"), ADDON.getLocalizedString(32109).encode("utf-8")
        )
    elif Settings.checkUserPinClash(enteredPin, pinId):
        # This pin clashes with an existing pin
        log("SetPin: Entered pin clashes with an existing pin")
        xbmcgui.Dialog().ok(
            ADDON.getLocalizedString(32001).encode("utf-8"), ADDON.getLocalizedString(32112).encode("utf-8")
        )
    else:
        # Now double check the value the user entered
        numberpad = NumberPad.createNumberPad(32107)
        numberpad.doModal()

        # Get the code that the user entered
        enteredPin2 = numberpad.getPin()
        del numberpad

        if enteredPin == enteredPin2:
            Settings.setUserPinValue(enteredPin, pinId)
        else:
            log("SetPin: Pin entry different, first: %s, second %s" % (enteredPin, enteredPin2))
            xbmcgui.Dialog().ok(
                ADDON.getLocalizedString(32001).encode("utf-8"), ADDON.getLocalizedString(32108).encode("utf-8")
            )
Exemple #3
0
def setPin(pinLevel=1):
    okToChangePin = True

    # Check if the pin is already set, if it is, then we need to prompt for that first
    # before we allow the user to just change it
    if Settings.isPinSet(pinLevel):
        log("SetPin: Existing pin set, prompting for it")
        # Prompt the user for the pin
        numberpad = NumberPad.createNumberPad(32105)
        numberpad.doModal()

        # Get the code that the user entered
        enteredPin = numberpad.getPin()
        del numberpad

        if not Settings.isPinCorrect(enteredPin, pinLevel):
            log("SetPin: Incorrect Existing Pin Entered")
            okToChangePin = False
            xbmcgui.Dialog().ok(
                ADDON.getLocalizedString(32001).encode('utf-8'),
                ADDON.getLocalizedString(32104).encode('utf-8'))
        else:
            log("SetPin: Correct Existing Pin Entered")

    # If we are OK to change the pin, prompt the user
    if okToChangePin:
        # Prompt the user for the pin
        numberpad = NumberPad.createNumberPad(32106)
        numberpad.doModal()

        # Get the code that the user entered
        enteredPin = numberpad.getPin()
        del numberpad

        # Check to ensure the user has either set no password or one the correct length
        if (len(enteredPin) > 0) and (Settings.getPinLength() >
                                      len(enteredPin)):
            log("SetPin: Incorrect length pin entered, expecting %d digits" %
                Settings.getPinLength())
            xbmcgui.Dialog().ok(
                ADDON.getLocalizedString(32001).encode('utf-8'),
                ADDON.getLocalizedString(32109).encode('utf-8'))
        elif Settings.checkPinClash(enteredPin, pinLevel):
            # This pin clashes with an existing pin
            log("SetPin: Entered pin clashes with an existing pin")
            xbmcgui.Dialog().ok(
                ADDON.getLocalizedString(32001).encode('utf-8'),
                ADDON.getLocalizedString(32112).encode('utf-8'))
        else:
            # Now double check the value the user entered
            numberpad = NumberPad.createNumberPad(32107)
            numberpad.doModal()

            # Get the code that the user entered
            enteredPin2 = numberpad.getPin()
            del numberpad

            if enteredPin == enteredPin2:
                Settings.setPinValue(enteredPin, pinLevel)
            else:
                log("SetPin: Pin entry different, first: %s, second %s" %
                    (enteredPin, enteredPin2))
                xbmcgui.Dialog().ok(
                    ADDON.getLocalizedString(32001).encode('utf-8'),
                    ADDON.getLocalizedString(32108).encode('utf-8'))
Exemple #4
0
def setPin(pinLevel=1):
    okToChangePin = True

    # Check if the pin is already set, if it is, then we need to prompt for that first
    # before we allow the user to just change it
    if Settings.isPinSet(pinLevel):
        log("SetPin: Existing pin set, prompting for it")
        # Prompt the user for the pin
        numberpad = NumberPad.createNumberPad(32105)
        numberpad.doModal()

        # Get the code that the user entered
        enteredPin = numberpad.getPin()
        del numberpad

        if not Settings.isPinCorrect(enteredPin, pinLevel):
            log("SetPin: Incorrect Existing Pin Entered")
            okToChangePin = False
            xbmcgui.Dialog().ok(
                ADDON.getLocalizedString(32001).encode("utf-8"), ADDON.getLocalizedString(32104).encode("utf-8")
            )
        else:
            log("SetPin: Correct Existing Pin Entered")

    # If we are OK to change the pin, prompt the user
    if okToChangePin:
        # Prompt the user for the pin
        numberpad = NumberPad.createNumberPad(32106)
        numberpad.doModal()

        # Get the code that the user entered
        enteredPin = numberpad.getPin()
        del numberpad

        # Check to ensure the user has either set no password or one the correct length
        if (len(enteredPin) > 0) and (Settings.getPinLength() > len(enteredPin)):
            log("SetPin: Incorrect length pin entered, expecting %d digits" % Settings.getPinLength())
            xbmcgui.Dialog().ok(
                ADDON.getLocalizedString(32001).encode("utf-8"), ADDON.getLocalizedString(32109).encode("utf-8")
            )
        elif Settings.checkPinClash(enteredPin, pinLevel):
            # This pin clashes with an existing pin
            log("SetPin: Entered pin clashes with an existing pin")
            xbmcgui.Dialog().ok(
                ADDON.getLocalizedString(32001).encode("utf-8"), ADDON.getLocalizedString(32112).encode("utf-8")
            )
        else:
            # Now double check the value the user entered
            numberpad = NumberPad.createNumberPad(32107)
            numberpad.doModal()

            # Get the code that the user entered
            enteredPin2 = numberpad.getPin()
            del numberpad

            if enteredPin == enteredPin2:
                Settings.setPinValue(enteredPin, pinLevel)
            else:
                log("SetPin: Pin entry different, first: %s, second %s" % (enteredPin, enteredPin2))
                xbmcgui.Dialog().ok(
                    ADDON.getLocalizedString(32001).encode("utf-8"), ADDON.getLocalizedString(32108).encode("utf-8")
                )