How do I customise the flask-user registration and login functions?
You seem to be asking about the flask-user package - however you tagged this with flask-security (which is a different package but offers similar functionality). I can answer for flask-security-too (my fork of the original flask-security) - if you are/want to use flask-user - it might be useful to change your tags.
In a nutshell - for flask-security - you can turn off ALL flashes with a config variable.
For registration - you can easily override the form and add a referral code - and validate/process that as part of form validation.
I want to customise the functions that process the results of completing the flask-user registration and login forms. I know how to customise the html forms themselves, but I want to change how flask-user performs the registration process. For example, I want to prevent the flask-user login and registration process from creating flash messages and I want registration to process a referral code.
I understand how to add an _after_registration_hook to perform actions after the registration function has completed, but, this doesn't allow me to remove the flash messages that are created in the login and registration processes.
My custom login and registration processes would build on the existing flask-user login and registration functions with functionality added or removed.