예제 #1
0
    def create_token(self):
        """Create a time-stamped token"""

        token = unicode(
            hashlib.sha512(str(time.time()) + self.username).hexdigest())

        DataToken.delete_by_username(self.username, self.action)
        # create new one
        token_instance = DataToken.new(token, self.username, self.action)
        return token_instance
예제 #2
0
파일: forms.py 프로젝트: Net-ng/kansha
    def create_token(self):
        """Create a time-stamped token"""

        token = unicode(
            hashlib.sha512(str(time.time()) + self.username).hexdigest())

        DataToken.delete_by_username(self.username, self.action)
        # create new one
        token_instance = DataToken.new(token, self.username, self.action)
        return token_instance
예제 #3
0
파일: forms.py 프로젝트: blugand/kansha
    def create_token(self):
        """Create a time-stamped token"""
        token = unicode(
            hashlib.sha512(str(time.time()) + self.username).hexdigest())

        DataToken.delete_by_username(self.username, self.action)
        # create new one
        token_instance = DataToken(token=token,
                                   username=self.username,
                                   action=self.action,
                                   date=datetime.now() + self.expiration_delay)
        return token_instance
예제 #4
0
파일: forms.py 프로젝트: Reigel/kansha
    def create_token(self):
        """Create a time-stamped token"""
        token = unicode(
            hashlib.sha512(str(time.time()) + self.username).hexdigest())

        DataToken.delete_by_username(self.username, self.action)
        # create new one
        token_instance = DataToken(token=token,
                                   username=self.username,
                                   action=self.action,
                                   date=datetime.now() + self.expiration_delay)
        return token_instance
예제 #5
0
 def reset_token(self, token):
     DataToken.get(token).delete()
예제 #6
0
 def check_token(self, token):
     """Check that the token is valid"""
     t = DataToken.get(token)
     return t and datetime.now() <= (t.date + self.expiration_delay)
예제 #7
0
파일: forms.py 프로젝트: Net-ng/kansha
 def reset_token(self, token):
     DataToken.get(token).delete()
예제 #8
0
파일: forms.py 프로젝트: Net-ng/kansha
 def check_token(self, token):
     """Check that the token is valid"""
     t = DataToken.get(token)
     return t and datetime.now() <= (t.date + self.expiration_delay)
예제 #9
0
파일: forms.py 프로젝트: blugand/kansha
 def check_token(self, token):
     """Check that the token is valid"""
     t = DataToken.get(token)
     return t and datetime.now() <= t.date
예제 #10
0
파일: forms.py 프로젝트: Reigel/kansha
 def check_token(self, token):
     """Check that the token is valid"""
     t = DataToken.get(token)
     return t and datetime.now() <= t.date