Пример #1
0
	def deleteUser(self, userId):
		"""Queues a deleteAccountValidation the given user
		
		userId: the unique id of the user
		
		raises InvalidUserId if the user does not exist
		
		returns verificationDict
		"""
		verificationType = "deleteAccount"
		verificationCode = ppwgen.generatePassword()
		verificationTime = time.time()
		userId = userId
		userEmail = self.getUserEmail(userId)
		
		session = DatabaseManager.dbmanager.session()
		try:
			verification = Verification(userEmail, verificationCode, verificationType, verificationTime, userId, None)
			session.add(verification)
			session.commit()
		finally:
			session.close()
			
		verificationDict = {
								'verificationType':verificationType, 
								'userEmail':userEmail, 
								'verificationCode':verificationCode, 
								'verificationTime':verificationTime
							}
			
		return verificationDict
Пример #2
0
	def changeUserKey(self, userId, seed):
		"""Queues an authenticationTokenChangeVerification for the given user
		
		userId: the unique id of the user
		
		raises InvalidUserId if the user does not exist
		
		returns verificationDict
		"""
		verificationType = "changeAccountKey"
		verificationCode = ppwgen.generatePassword()
		verificationTime = time.time()
		userId = userId
		userEmail = self.getUserEmail(userId)
		
		session = DatabaseManager.dbmanager.session()
		try:
			verification = Verification(userEmail, verificationCode, verificationType, verificationTime, userId, seed)
			session.add(verification)
			session.commit()
		finally:
			session.close()
			
		verificationDict = {
								'verificationType':verificationType, 
								'userEmail':userEmail, 
								'verificationCode':verificationCode, 
								'verificationTime':verificationTime
							}
			
		return verificationDict
Пример #3
0
	def createUser(self, userEmail, seed):
		"""Queues a createAccountVerification for the given Email
		
		userEmail: email to link to new account and to email verification to
		authenticationTokenSeed: desired authentication token
		
		raises InvalidEmail if the email is not canonical
		
		returns verificationDict
		"""
		
		verificationType = "createAccount"
		verificationCode = ppwgen.generatePassword()
		verificationTime = time.time()
		userId = None
		
		session = DatabaseManager.dbmanager.session()
		try:
			verification = Verification(userEmail, verificationCode, verificationType, verificationTime, userId, seed)
			session.add(verification)
			session.commit()
		finally:
			session.close()
			
		verificationDict = {
								'verificationType':verificationType, 
								'userEmail':userEmail, 
								'verificationCode':verificationCode, 
								'verificationTime':verificationTime
							}
			
		return verificationDict
Пример #4
0
Events = cxsbs.getResource("Events")
Players = cxsbs.getResource("Players")
ServerCore = cxsbs.getResource("ServerCore")
Messages = cxsbs.getResource("Messages")
Commands = cxsbs.getResource("Commands")

import ppwgen

pluginCategory = 'SetMaster'

SettingsManager.addSetting(Setting.Setting	(
												category=pluginCategory, 
												subcategory="General", 
												symbolicName="admin_password", 
												displayName="Admin password", 
												default=ppwgen.generatePassword(),
												doc="Password used to allow clients to use \"/setmaster <password>\" to claim admin."
											))

SettingsManager.addSetting(Setting.Setting	(
												category=pluginCategory, 
												subcategory="General", 
												symbolicName="connect_password", 
												displayName="Connect password", 
												default=ppwgen.generatePassword(),
												doc="Password used to allow clients to connect if kicked or server is in private."
											))

SettingsManager.addSetting(Setting.BoolSetting	(
												category=pluginCategory, 
												subcategory="General",