API - send an email after successful password reset

This commit is contained in:
Sam
2022-03-13 09:01:23 +01:00
parent ae0b9c36b2
commit c155efc7ec
2 changed files with 77 additions and 1 deletions

View File

@ -1296,6 +1296,20 @@ def update_password() -> Union[Dict, HttpResponse]:
password, current_app.config.get('BCRYPT_LOG_ROUNDS')
).decode()
db.session.commit()
password_change_email.send(
{
'language': ('en' if user.language is None else user.language),
'email': user.email,
},
{
'username': user.username,
'fittrackee_url': current_app.config['UI_URL'],
'operating_system': request.user_agent.platform,
'browser_name': request.user_agent.browser,
},
)
return {
'status': 'success',
'message': 'password updated',