Ejemplo n.º 1
0
 def test_13_check_otp(self):
     db_token = Token.query.filter_by(serial=self.serial1).first()
     token = HotpTokenClass(db_token)
     token.update({"otpkey": self.otpkey, "pin": "test", "otplen": 6})
     # OTP does not exist
     self.assertTrue(token.check_otp_exist("222333") == -1)
     # OTP does exist
     res = token.check_otp_exist("969429")
     self.assertTrue(res == 3, res)
Ejemplo n.º 2
0
 def test_13_check_otp(self):
     db_token = Token.query.filter_by(serial=self.serial1).first()
     token = HotpTokenClass(db_token)
     token.update({"otpkey": self.otpkey,
                   "pin": "test",
                   "otplen": 6})
     # OTP does not exist
     self.assertTrue(token.check_otp_exist("222333") == -1)
     # OTP does exist
     res = token.check_otp_exist("969429")
     self.assertTrue(res == 3, res)
Ejemplo n.º 3
0
    def check_otp_exist(self, otp, window=10):
        """
        checks if the given OTP value is/are values of this very token.
        This is used to autoassign and to determine the serial number of
        a token.

        :param otp: the to be verified otp value
        :type otp: string
        :param window: the lookahead window for the counter
        :type window: int
        :return: counter or -1 if otp does not exist
        :rtype:  int
        """
        otp = _daplug2digit(otp)
        res = HotpTokenClass.check_otp_exist(self, otp, window)
        return res
Ejemplo n.º 4
0
    def check_otp_exist(self, otp, window=10):
        """
        checks if the given OTP value is/are values of this very token.
        This is used to autoassign and to determine the serial number of
        a token.

        :param otp: the to be verified otp value
        :type otp: string
        :param window: the lookahead window for the counter
        :type window: int
        :return: counter or -1 if otp does not exist
        :rtype:  int
        """
        otp = _daplug2digit(otp)
        res = HotpTokenClass.check_otp_exist(self, otp, window)
        return res