update_user.js module provides two functions for modifying user credentials: update_email and update_password. Both update Firebase Authentication directly using the Admin SDK.
Functions overview
| Function | What it updates |
|---|---|
update_email | Firebase Auth email + Firestore email field + date.last_update |
update_password | Firebase Auth password only |
update_email
Updates a user’s email address in Firebase Authentication and then updates the matching document in the specified Firestore collection.
Endpoint
Request
The Firebase Authentication UID of the user whose email is being updated.
The new email address to set.
The user’s current (old) email address. Used to locate the Firestore document to update.
The Firestore collection containing the user’s document. One of
u_clients, u_collaborators, or u_staff.What it does
- Calls
auth.updateUser(uid, { email })to update the email in Firebase Authentication. - Queries
{collection}for documents whereemail == emailold. - For each matching document, updates:
email→ the new email addressdate.last_update→Timestamp.now()
Response
Success (200):"Usuario: Email Actualizado!"200"Usuario: Email No Actualizado!!"400update_password
Updates a user’s password in Firebase Authentication.
Endpoint
Response
Success (200):The
update_password function updates Firebase Authentication only. No Firestore fields are modified when changing a password.