def authenticate(username, password):
"""
Authenticate a username/password - this sample routine simply checks
the username/password against a hard-coded table, a real-world
implementation would authenticate users against a database or external
service.
"""
user = username_table.get(username, None)
if user and safe_str_cmp(user.password.encode('utf-8'),
password.encode('utf-8')):
return user
评论列表
文章目录