mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
Merge pull request #3169 from alphagov/remove-old-user-email-endpoint
add POST get user by email endpoint
This commit is contained in:
@@ -419,6 +419,19 @@ def set_permissions(user_id, service_id):
|
||||
return jsonify({}), 204
|
||||
|
||||
|
||||
@user_blueprint.route('/email', methods=['POST'])
|
||||
def fetch_user_by_email():
|
||||
|
||||
email, errors = email_data_request_schema.load(request.get_json())
|
||||
if errors:
|
||||
raise InvalidRequest(message=errors, status_code=400)
|
||||
|
||||
fetched_user = get_user_by_email(email['email'])
|
||||
result = fetched_user.serialize()
|
||||
return jsonify(data=result)
|
||||
|
||||
|
||||
# TODO: Deprecate this GET endpoint
|
||||
@user_blueprint.route('/email', methods=['GET'])
|
||||
def get_by_email():
|
||||
email = request.args.get('email')
|
||||
|
||||
Reference in New Issue
Block a user