Skip to content

Commit d422935

Browse files
fix(auth): adds missing EMAIL_NOT_FOUND error code (#298)
* fix(auth): adds missing EMAIL_NOT_FOUND error code Catch EMAIL_NOT_FOUND when /accounts:sendOobCode is called for password reset on a user that does not exist.
1 parent e71b52a commit d422935

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

FirebaseAdmin/FirebaseAdmin.Tests/Auth/AuthErrorHandlerTest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ public class AuthErrorHandlerTest
5757
ErrorCode.NotFound,
5858
AuthErrorCode.UserNotFound,
5959
},
60+
new object[]
61+
{
62+
"EMAIL_NOT_FOUND",
63+
ErrorCode.NotFound,
64+
AuthErrorCode.EmailNotFound,
65+
},
6066
};
6167

6268
[Theory]

FirebaseAdmin/FirebaseAdmin/Auth/AuthErrorCode.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,12 @@ public enum AuthErrorCode
9898
/// Tenant ID in a token does not match.
9999
/// </summary>
100100
TenantIdMismatch,
101+
102+
/// <summary>
103+
/// No user record found for the given email, typically raised when
104+
/// generating a password reset link using an email for a user that
105+
/// is not already registered.
106+
/// </summary>
107+
EmailNotFound,
101108
}
102109
}

FirebaseAdmin/FirebaseAdmin/Auth/AuthErrorHandler.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ internal sealed class AuthErrorHandler
6363
AuthErrorCode.EmailAlreadyExists,
6464
"The user with the provided email already exists")
6565
},
66+
{
67+
"EMAIL_NOT_FOUND",
68+
new ErrorInfo(
69+
ErrorCode.NotFound,
70+
AuthErrorCode.EmailNotFound,
71+
"No user record found for the given email")
72+
},
6673
{
6774
"INVALID_DYNAMIC_LINK_DOMAIN",
6875
new ErrorInfo(

0 commit comments

Comments
 (0)