def login(cls, name, pw): u = cls.by_name(name) if u and HashManager.valid_pw(name, pw, u.pw_hash): return u