Is there some convenient way to override register view in Flask-Security? I'm pretty happy with the built-in view for registration, but I need it to be accessible only after authentication and by certain roles.
I tried to override it like this (with SECURITY_REGISTER_URL='/register/'
) but that just takes the built-in function and mine is completely ignored:
@app.route('/register/')
@login_required
@roles_required('superuser')
def register():
"""View function which handles a registration request."""
...
So the question is - do I have to write my own register view from peak and disable the Flask-Security registration?
I thought also about checking the user login/role in register_user.html template and possibly redirecting back to home page, but I'm not sure if that's the correct way to achieve this...