Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app/api/auth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import base64
import logging
import random
import string

Expand Down Expand Up @@ -32,6 +33,7 @@
from app.api.helpers.storage import UPLOAD_PATHS
from app.api.helpers.auth import AuthManager

logger = logging.getLogger(__name__)
authorised_blueprint = Blueprint('authorised_blueprint', __name__, url_prefix='/')
ticket_blueprint = Blueprint('ticket_blueprint', __name__, url_prefix='/v1')
auth_routes = Blueprint('auth', __name__, url_prefix='/v1/auth')
Expand Down Expand Up @@ -224,15 +226,16 @@ def reset_password_post():
try:
user = User.query.filter_by(email=email).one()
except NoResultFound:
return NotFoundError({'source': ''}, 'User not found').respond()
logger.info('Tried to reset password not existing email %s', email)
else:
link = make_frontend_url('/reset-password', {'token': user.reset_password})
if user.was_registered_with_order:
send_email_with_action(user, PASSWORD_RESET_AND_VERIFY, app_name=get_settings()['app_name'], link=link)
else:
send_email_with_action(user, PASSWORD_RESET, app_name=get_settings()['app_name'], link=link)

return make_response(jsonify(message="Email Sent"), 200)
return make_response(jsonify(message="If your email was registered with us, you'll get an \
email with reset link shortly", email=email), 200)


@auth_routes.route('/reset-password', methods=['PATCH'])
Expand Down