Logo Search packages:      
Sourcecode: zope-passwordresettool version File versions  Download package

def PasswordResetTool::PasswordResetTool::PasswordResetTool::uniqueString (   self,
  userid 
)
Returns a string that is random and unguessable, or at
least as close as possible.

This is used by 'requestReset' to generate the auth
string. Override if you wish different format.

This implementation ignores userid and simply generates a
UUID. That parameter is for convenience of extenders, and
will be passed properly in the default implementation.

Definition at line 254 of file PasswordResetTool.py.

                                  :
        """Returns a string that is random and unguessable, or at
        least as close as possible.

        This is used by 'requestReset' to generate the auth
        string. Override if you wish different format.

        This implementation ignores userid and simply generates a
        UUID. That parameter is for convenience of extenders, and
        will be passed properly in the default implementation."""
        # this is the informal UUID algorithm of
        # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/213761
        # by Carl Free Jr
        t = long( time.time() * 1000 )
        r = long( random.random()*100000000000000000L )
        try:
            a = socket.gethostbyname( socket.gethostname() )
        except:
            # if we can't get a network address, just imagine one
            a = random.random()*100000000000000000L
        data = str(t)+' '+str(r)+' '+str(a)#+' '+str(args)
        data = md5.md5(data).hexdigest()
        return str(data)


Generated by  Doxygen 1.6.0   Back to index