def create_user(**data):
if 'username' not in data or 'password' not in data:
raise ValueError('username and password are required.')
data['_id'] = data['username']
data['password'] = generate_password_hash(
data.pop('password'),
method='pbkdf2:sha256'
)
# current_app.db.users.insert_one(data)
current_app.db.insert('users', data)
return data
评论列表
文章目录