def create_user_routes(server):

    @server.login.user_loader
    def load_user(id):
        return User.query.get(int(id))

    @server.app.route(f'/{server.api_version}/login', methods=['GET', 'POST'])
    def login():
        form = LoginForm()
        nxt = request.args.get('next')
        if form.validate_on_submit():
            user = User()
            login_user(user)
            flash('Logged in successfully.')
        return redirect((nxt or '/'))
def create_user_routes(server):

    @server.login.user_loader
    def load_user(id):
        return User.query.get(int(id))

    @server.app.route(f'/{server.api_version}/login', methods=['GET', 'POST'])
    def login():
        form = LoginForm()
        nxt = request.args.get('next')
        if form.validate_on_submit():
            user = User()
            login_user(user)
            flash('Logged in successfully.')
        return redirect((nxt or '/'))