当前位置: 首页>>代码示例>>Python>>正文


Python GLIUtility.hash_password方法代码示例

本文整理汇总了Python中GLIUtility.hash_password方法的典型用法代码示例。如果您正苦于以下问题:Python GLIUtility.hash_password方法的具体用法?Python GLIUtility.hash_password怎么用?Python GLIUtility.hash_password使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GLIUtility的用法示例。


在下文中一共展示了GLIUtility.hash_password方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_treeview_data

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import hash_password [as 别名]
	def get_treeview_data(self):
		data = []
		treeiter = self.treedata.get_iter_first()
		
		while treeiter !=None:
			user = self.treedata.get_value(treeiter,1)
			passwd = self.treedata.get_value(treeiter,0)
			
			# if the user was loaded from a profile, do NOT
			# hash the password, but carry it through
			if user not in self.users_from_profile:
				pass_hash = GLIUtility.hash_password(passwd)
			else:
				pass_hash = passwd
				
			groups = self.treedata.get_value(treeiter,2)
			shell = self.treedata.get_value(treeiter,3)
			homedir = self.treedata.get_value(treeiter,4)
			userid = self.treedata.get_value(treeiter,5)
			comment = self.treedata.get_value(treeiter,6)
			try:
				group_tuple = tuple(groups.split(","))
			except:
				# must be only 1 group
				group_tuple = (groups)
			
			data.append([user,pass_hash,group_tuple,shell,homedir,userid,comment])
			treeiter = self.treedata.iter_next(treeiter)
			
		return data
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:32,代码来源:Users.py

示例2: deactivate

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import hash_password [as 别名]
	def deactivate(self):
		# store everything
		if (self.root_verified):
			
			if self.is_root_pass_set():
				# don't hash the password, just store it
				root_hash = self.root1.get_text()
			else:
				# hash the password
				root_hash = GLIUtility.hash_password(self.root1.get_text())
				
			# store the root password
			self.controller.install_profile.set_root_pass_hash(None,root_hash,None)
			
			# now store all the entered users
			#( <user name>, <password hash>, (<tuple of groups>), <shell>, 
			#  <home directory>, <user id>, <user comment> )
			# retrieve everything
			data = self.get_treeview_data()

			stored_users = []
			# get the array of stored usernames
			for item in list(self.controller.install_profile.get_users()):
				stored_users.append(item[0])
				
			for user in data:
				if user[0] not in self.current_users and user[0] not in stored_users:
					# user is not in stored profile, and hasn't been previously added
					self.controller.install_profile.add_user(None, (user[0], user[1], user[2], user[3], user[4], user[5], user[6]), None)
					#self.current_users.append(user[0])
				elif user[0] in stored_users:
					# user is in stored profile, need to remove, then readd the user
					self.controller.install_profile.remove_user(user[0])
					self.controller.install_profile.add_user(None, (user[0], user[1], user[2], user[3], user[4], user[5], user[6]), None)
					#self.current_users.append(user[0])
				
			return True
		else:
			msgbox=Widgets().error_Box("Error","You have not verified your root password!")
			msgbox.run()
			msgbox.destroy()
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:43,代码来源:Users.py


注:本文中的GLIUtility.hash_password方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。