Skip to content

Commit

Permalink
fix(auth): adds missing EMAIL_NOT_FOUND error code (#298)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
bojeil-google authored May 4, 2021
1 parent e71b52a commit d422935
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public class AuthErrorHandlerTest
ErrorCode.NotFound,
AuthErrorCode.UserNotFound,
},
new object[]
{
"EMAIL_NOT_FOUND",
ErrorCode.NotFound,
AuthErrorCode.EmailNotFound,
},
};

[Theory]
Expand Down
7 changes: 7 additions & 0 deletions FirebaseAdmin/FirebaseAdmin/Auth/AuthErrorCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,12 @@ public enum AuthErrorCode
/// Tenant ID in a token does not match.
/// </summary>
TenantIdMismatch,

/// <summary>
/// No user record found for the given email, typically raised when
/// generating a password reset link using an email for a user that
/// is not already registered.
/// </summary>
EmailNotFound,
}
}
7 changes: 7 additions & 0 deletions FirebaseAdmin/FirebaseAdmin/Auth/AuthErrorHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ internal sealed class AuthErrorHandler
AuthErrorCode.EmailAlreadyExists,
"The user with the provided email already exists")
},
{
"EMAIL_NOT_FOUND",
new ErrorInfo(
ErrorCode.NotFound,
AuthErrorCode.EmailNotFound,
"No user record found for the given email")
},
{
"INVALID_DYNAMIC_LINK_DOMAIN",
new ErrorInfo(
Expand Down

0 comments on commit d422935

Please sign in to comment.