ai-cfia / membrane-backend

Membrane Backend: A centralized authentication service for Single Sign-On (SSO) enabling seamless token-based email verification across multiple client applications.
MIT License
1 stars 0 forks source link

Implement email regex for POST request #2

Closed CFIALeronB closed 1 year ago

CFIALeronB commented 1 year ago

Functionality:

The endpoint, accessed via the '/validate_email' route, is designed to validate an email address provided in the request JSON data. It expects the request payload to be a JSON object with a field named 'email' containing the email address to validate. The validation process ensures that the email is both properly formatted and ends with one of the allowed domains: 'gc.ca', 'canada.ca', or 'inspection.gc.ca'.

Returns:

If the email is valid, the function responds with a JSON object containing the message 'Valid email address.' and a status code of 200.

If the email is invalid or missing in the request, the function responds with a JSON object containing the error message 'Invalid email address.' and a status code of 400.