[英]How do Homebrew, PIP, easy_install etc. work so that I can clean up
[英]How do i make a user profile so that i will input the name, mail etc. and then it saves, so i can login
class User:
def __init__(self, username, email, date_of_birth, password):
self.username = username
self.email = email
self.date_of_birth = date_of_birth
self.password = password
@staticmethod
def login_or_register():
userinput = input("login or register")
def register(self):
pass
def login(self, login_reg):
self.login_reg = login_reg
我如何制作用戶配置文件,以便我輸入姓名、郵件等,然后保存以便我可以登錄
這是一個非常簡單的方法:
import hashlib
db = {}
hash = lambda x: hashlib.md5(x.encode()).hexdigest()
def register(user, password, mail):
db[user] = {"password": hash(password), "mail": mail}
def login(user, password):
if db[user]["password"] == hash(password):
print("success!")
else:
print("fail")
register("ironkey", "password123", "example@example.com")
login("ironkey", "password")
login("ironkey", "password123")
# get credentials for the user ironkey
print(db["ironkey"])
fail
success!
{'password': '482c811da5d5b4bc6d497ffa98491e38', 'mail': 'example@example.com'}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.