mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-15 15:28:02 -04:00
Add data endpoint for finding users by full or partial email
This commit is contained in:
@@ -16,6 +16,7 @@ from app.dao.users_dao import (
|
||||
increment_failed_login_count,
|
||||
reset_failed_login_count,
|
||||
get_user_by_email,
|
||||
get_users_by_partial_email,
|
||||
create_secret_code,
|
||||
save_user_attribute,
|
||||
update_user_password,
|
||||
@@ -32,6 +33,7 @@ from app.notifications.process_notifications import (
|
||||
)
|
||||
from app.schemas import (
|
||||
email_data_request_schema,
|
||||
partial_email_data_request_schema,
|
||||
create_user_schema,
|
||||
permission_schema,
|
||||
user_update_schema_load_json,
|
||||
@@ -356,6 +358,14 @@ def get_by_email():
|
||||
return jsonify(data=result)
|
||||
|
||||
|
||||
@user_blueprint.route('/find-users-by-email', methods=['POST'])
|
||||
def find_users_by_email():
|
||||
email, errors = partial_email_data_request_schema.load(request.get_json())
|
||||
fetched_users = get_users_by_partial_email(email['email'])
|
||||
result = [user.serialize() for user in fetched_users]
|
||||
return jsonify(data=result), 200
|
||||
|
||||
|
||||
@user_blueprint.route('/reset-password', methods=['POST'])
|
||||
def send_user_reset_password():
|
||||
email, errors = email_data_request_schema.load(request.get_json())
|
||||
|
||||
Reference in New Issue
Block a user