def split_pin_otp(token, passw, user=None, options=None): ''' split the pin and the otp fron the given password :param passw: the to be splitted password :param options: currently not used, but might be forwarded to the token.splitPinPass :return: tuple of (split status, pin and otpval) ''' pin_policies = linotp.lib.policy.get_pin_policies(user) policy = 0 if 1 in pin_policies: LOG.debug("[split_pin_otp] pin policy=1: checking the " "users password as pin") # split the passw into password and otp value (res, pin, otp) = token.splitPinPass(passw) policy = 1 elif 2 in pin_policies: # NO PIN should be entered atall LOG.debug("[split_pin_otp] pin policy=2: checking no pin") (res, pin, otp) = (0, "", passw) policy = 2 else: # old stuff: We check The fixed OTP PIN LOG.debug("[split_pin_otp] pin policy=0: checkin the PIN") (res, pin, otp) = token.splitPinPass(passw) if res != -1: res = policy return (res, pin, otp)
def split_pin_otp(token, passw, user=None, options=None): """ split the pin and the otp fron the given password :param passw: the to be splitted password :param options: currently not used, but might be forwarded to the token.splitPinPass :return: tuple of (split status, pin and otpval) """ pin_policies = linotp.lib.policy.get_pin_policies(user) policy = 0 if 1 in pin_policies: LOG.debug("[split_pin_otp] pin policy=1: checking the " "users password as pin") # split the passw into password and otp value (res, pin, otp) = token.splitPinPass(passw) policy = 1 elif 2 in pin_policies: # NO PIN should be entered atall LOG.debug("[split_pin_otp] pin policy=2: checking no pin") (res, pin, otp) = (0, "", passw) policy = 2 else: # old stuff: We check The fixed OTP PIN LOG.debug("[split_pin_otp] pin policy=0: checkin the PIN") (res, pin, otp) = token.splitPinPass(passw) if res != -1: res = policy return (res, pin, otp)