@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 '/'))
@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 '/'))