Also one can also say there is no way to pass custom view function to change or reset password so that any exceptions occurred can be handled.
I my case I have set SECURITY_SEND_PASSWORD_CHANGE_EMAIL and SECURITY_SEND_PASSWORD_RESET_EMAIL to True. However if SMTP is not configured then changing or resetting password fails very badly in debug mode. (see below exception) And in case of production mode no response is sent to http request.
Instead I want to handle such exceptions and show proper error message to user (like SMTP not configured)
File "/lib/python3.4/site-packages/flask_security/utils.py", line 341, in send_mail
mail.send(msg)
File "/lib/python3.4/site-packages/flask_mail.py", line 491, in send
with self.connect() as connection:
File "/lib/python3.4/site-packages/flask_mail.py", line 144, in __enter__
self.host = self.configure_host()
File "/lib/python3.4/site-packages/flask_mail.py", line 158, in configure_host
host = smtplib.SMTP(self.mail.server, self.mail.port)
File "/usr/lib/python3.4/smtplib.py", line 242, in __init__
(code, msg) = self.connect(host, port)
File "/usr/lib/python3.4/smtplib.py", line 321, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib/python3.4/smtplib.py", line 292, in _get_socket
self.source_address)
File "/usr/lib/python3.4/socket.py", line 512, in create_connection
raise err
File "/usr/lib/python3.4/socket.py", line 503, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused