@umituz/react-native-auth 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -83,3 +83,11 @@ export class AuthInvalidEmailError extends AuthError {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
export class AuthInvalidCredentialError extends AuthError {
|
|
87
|
+
constructor(message: string = "Invalid email or password") {
|
|
88
|
+
super(message, "AUTH_INVALID_CREDENTIAL");
|
|
89
|
+
this.name = "AuthInvalidCredentialError";
|
|
90
|
+
Object.setPrototypeOf(this, AuthInvalidCredentialError.prototype);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
package/src/index.ts
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
AuthWrongPasswordError,
|
|
25
25
|
AuthUserNotFoundError,
|
|
26
26
|
AuthNetworkError,
|
|
27
|
+
AuthInvalidCredentialError,
|
|
27
28
|
} from "../../domain/errors/AuthError";
|
|
28
29
|
import type { AuthConfig } from "../../domain/value-objects/AuthConfig";
|
|
29
30
|
import { DEFAULT_AUTH_CONFIG } from "../../domain/value-objects/AuthConfig";
|
|
@@ -116,6 +117,10 @@ function mapFirebaseAuthError(error: any): Error {
|
|
|
116
117
|
if (code === "auth/too-many-requests") {
|
|
117
118
|
return new AuthError("Too many requests. Please try again later.", "AUTH_TOO_MANY_REQUESTS");
|
|
118
119
|
}
|
|
120
|
+
// Firebase v9+ uses auth/invalid-credential for both wrong email and wrong password
|
|
121
|
+
if (code === "auth/invalid-credential") {
|
|
122
|
+
return new AuthInvalidCredentialError();
|
|
123
|
+
}
|
|
119
124
|
|
|
120
125
|
return new AuthError(message, code);
|
|
121
126
|
}
|