1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-22 16:29:09 +01:00

Ps 971/rate limiting error gives html (#3097)

* made changes in the errorResponse.ts to return toast message for status 429

* refactor the existing bug implementation

Co-authored-by: dynwee <onwudiweokeke@gmail.com>
This commit is contained in:
cyprain-okeke 2022-07-20 20:21:13 +01:00 committed by GitHub
parent cadba40109
commit 01dd22fda8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,15 +21,13 @@ export class ErrorResponse extends BaseResponse {
}
}
if (errorModel) {
if (status === 429) {
this.message = "Rate limit exceeded. Try again later.";
} else if (errorModel) {
this.message = this.getResponseProperty("Message", errorModel);
this.validationErrors = this.getResponseProperty("ValidationErrors", errorModel);
this.captchaSiteKey = this.validationErrors?.HCaptcha_SiteKey?.[0];
this.captchaRequired = !Utils.isNullOrWhitespace(this.captchaSiteKey);
} else {
if (status === 429) {
this.message = "Rate limit exceeded. Try again later.";
}
}
this.statusCode = status;
}