def login(cls, name, pw): u = cls.by_name(name) if u and HashManager.valid_pw(name, pw, u.pw_hash): return u
def register(cls, name, pw, email=None): pw_hash = HashManager.make_pw_hash(name, pw) return User(parent=users_key(), name=name, pw_hash=pw_hash, email=email)