Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use HTTP 401 Unauthorized for invalid login attempts #237

Merged
merged 1 commit into from
Jun 30, 2020
Merged

Conversation

liangyuanruo
Copy link
Contributor

Problem

When an invalid email is used to attempt login, a HTTP 401 Unauthorized should be returned instead of the default HTTP 400 Bad Request.

Solution

Configure the validation middleware to return HTTP 401 if custom Joi email validation fails, instead of handing the error off to Express's next(error) as is the default.

Deploy Notes

This is technically a breaking change, but necessary as we proceed to configure Cloudwatch alerts.

…mail validation

This affects the /otp and /verify routes
Copy link
Contributor

@JasonChong96 JasonChong96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@liangyuanruo liangyuanruo merged commit bdc38f8 into develop Jun 30, 2020
@liangyuanruo liangyuanruo deleted the 401 branch June 30, 2020 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants