@umituz/react-native-auth 1.0.3 → 1.0.4
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
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from "firebase/auth";
|
|
15
15
|
import type { IAuthService, SignUpParams, SignInParams } from "../../application/ports/IAuthService";
|
|
16
16
|
import {
|
|
17
|
+
AuthError,
|
|
17
18
|
AuthInitializationError,
|
|
18
19
|
AuthConfigurationError,
|
|
19
20
|
AuthValidationError,
|
|
@@ -23,6 +24,7 @@ import {
|
|
|
23
24
|
AuthWrongPasswordError,
|
|
24
25
|
AuthUserNotFoundError,
|
|
25
26
|
AuthNetworkError,
|
|
27
|
+
AuthInvalidCredentialError,
|
|
26
28
|
} from "../../domain/errors/AuthError";
|
|
27
29
|
import type { AuthConfig } from "../../domain/value-objects/AuthConfig";
|
|
28
30
|
import { DEFAULT_AUTH_CONFIG } from "../../domain/value-objects/AuthConfig";
|
|
@@ -109,6 +111,9 @@ function mapFirebaseAuthError(error: any): Error {
|
|
|
109
111
|
if (code === "auth/wrong-password") {
|
|
110
112
|
return new AuthWrongPasswordError();
|
|
111
113
|
}
|
|
114
|
+
if (code === "auth/invalid-credential") {
|
|
115
|
+
return new AuthInvalidCredentialError();
|
|
116
|
+
}
|
|
112
117
|
if (code === "auth/network-request-failed") {
|
|
113
118
|
return new AuthNetworkError();
|
|
114
119
|
}
|