def login(): json_data = request.get_json() try: user = User.get(username=json_data.get('username')) except User.DoesNotExist: return error((211, 'Could not find user')) if not user.verify_password(json_data.get('password')): return error((210, 'The username and password mismatch.')) login_user(user) return ok(dump_user(user))
def login(): json_data = request.get_json() try: user = User.get( username=json_data.get('username')) except User.DoesNotExist: return error((211, 'Could not find user')) if not user.verify_password(json_data.get('password')): return error((210, 'The username and password mismatch.')) login_user(user) return ok(dump_user(user))
def load_user(userid): return User.get(User.id == userid)