0
我正在嘗試使用BCryptAuth來保護資源以及登錄系統。 我想根據用戶在登錄頁面輸入的電子郵件只抓取一個文檔。爲什麼find_one在我的情況下返回所有文檔?
class BCryptAuth(BasicAuth):
def check_auth(self, email, password, allowed_roles, resource, method):
account = app.data.driver.db['users'].find_one({'email': email})
return account and \
bcrypt.hashpw(password.encode('utf-8'),account['salt'].encode('utf-8')) == account['password']
但是,當我嘗試通過郵遞員訪問用戶端點時,它實際進行身份驗證但返回所有文檔。我有點困惑。如果我的方法不對,請給我一個。