feat(core): Rate limit forgot password endpoint (#7604)

Github issue / Community forum post (link here to close automatically):

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <netroy@users.noreply.github.com>
This commit is contained in:
Ricardo Espinoza
2023-11-03 13:44:12 -04:00
committed by GitHub
parent acec9bad71
commit 5790e251b8
7 changed files with 52 additions and 12 deletions

View File

@@ -88,14 +88,20 @@ export default defineComponent({
});
} catch (error) {
let message = this.$locale.baseText('forgotPassword.smtpErrorContactAdministrator');
if (error.httpStatusCode === 422) {
message = this.$locale.baseText(error.message);
if (error.isAxiosError) {
const { status } = error.response;
if (status === 429) {
message = this.$locale.baseText('forgotPassword.tooManyRequests');
} else if (error.httpStatusCode === 422) {
message = this.$locale.baseText(error.message);
}
this.showMessage({
type: 'error',
title: this.$locale.baseText('forgotPassword.sendingEmailError'),
message,
});
}
this.showMessage({
type: 'error',
title: this.$locale.baseText('forgotPassword.sendingEmailError'),
message,
});
}
this.loading = false;
},