Merge pull request #10394 from overleaf/ii-password-reset-and-strength-checking

[web] Password reset strength checking and UI updates

GitOrigin-RevId: 442a5c9e7e9d0a61d3ae649f3526bc3c02fd5704
This commit is contained in:
ilkin-overleaf
2022-12-07 09:03:36 +00:00
committed by Copybot
parent 887ac13f06
commit 2675cab92e
21 changed files with 309 additions and 159 deletions
@@ -76,6 +76,10 @@ export class FetchError extends OError {
this.data = data
}
getErrorMessageKey() {
return this.data?.message?.key as string | undefined
}
getUserFacingMessage() {
const statusCode = this.response?.status
const defaultMessage = getErrorMessageForStatusCode(statusCode)
@@ -210,6 +214,18 @@ async function parseResponseBody(response: Response) {
return {}
}
export function getErrorMessageKey(error: Error | null) {
if (!error) {
return undefined
}
if (error instanceof FetchError) {
return error.getErrorMessageKey()
}
return error.message
}
export function getUserFacingMessage(error: Error | null) {
if (!error) {
return undefined