當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。