Skip to content

Commit b29bb2f

Browse files
Fixed removing email
1 parent 3773b64 commit b29bb2f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

firebase_admin/_user_mgt.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ def update_user(self, uid, display_name=None, email=None, phone_number=None,
692692
"""Updates an existing user account with the specified properties"""
693693
payload = {
694694
'localId': _auth_utils.validate_uid(uid, required=True),
695-
'email': _auth_utils.validate_email(email),
695+
'email': _auth_utils.validate_email(email) if email is not DELETE_ATTRIBUTE else None,
696696
'password': _auth_utils.validate_password(password),
697697
'validSince': _auth_utils.validate_timestamp(valid_since, 'valid_since'),
698698
'emailVerified': bool(email_verified) if email_verified is not None else None,
@@ -720,6 +720,12 @@ def update_user(self, uid, display_name=None, email=None, phone_number=None,
720720
else:
721721
payload['phoneNumber'] = _auth_utils.validate_phone(phone_number)
722722

723+
if email is not None:
724+
if email is DELETE_ATTRIBUTE:
725+
remove_provider.append('email')
726+
else:
727+
payload['email'] = _auth_utils.validate_email(email)
728+
723729
if custom_claims is not None:
724730
if custom_claims is DELETE_ATTRIBUTE:
725731
custom_claims = {}

0 commit comments

Comments
 (0)