Exemple #1
0
def create(userid, secret, server):
    """Creates a new user with a random username and no password, and
writes it out to backing storage."""

    result = user(common.random_hex_string())
    result.set_state(server, "userid", userid)
    result.set_state(server, "secret", secret)
    result.save(1)

    return result
Exemple #2
0
 def session_key(self):
     "Returns a session key that can later be passed to from_session_key() to retrieve this user."
     key = common.random_hex_string()
     mutex = common.mutex("sessions.lock")
     mutex.get()
     sessions = shelve.open(sessions_file)
     sessions[key] = self.username
     sessions.close()
     mutex.drop()
     return key
Exemple #3
0
			def __init__(self, base, email, sharedsecret):
				multiline.__init__(self)
				self.clientnonce = common.random_hex_string()
				self.hash = md5.new()
				self.base = base
				self.email = email[0:16]
				while len(self.email)<16:
					# pad with nuls if it's <16 bytes
					self.email += '\0'
				self.sharedsecret = sharedsecret