Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fluffy-seas-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/auth": patch
---

Explicitly set createdAt and lastLoginAt when cloning UserImpl
5 changes: 4 additions & 1 deletion packages/auth/src/core/user/user_impl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,9 @@ describe('core/user/user_impl', () => {
uid: 'i-am-uid'
}
],
tenantId: 'tenant-id'
tenantId: 'tenant-id',
createdAt: '2018-01-01 13:02:56.12345678',
lastLoginAt: '2018-01-05 13:02:56.12345678'
});

const newAuth = await testAuth();
Expand All @@ -294,6 +296,7 @@ describe('core/user/user_impl', () => {
uid: 'i-am-uid'
}
]);
expect(copy.metadata.toJSON()).to.eql(user.metadata.toJSON());
});
});
});
4 changes: 3 additions & 1 deletion packages/auth/src/core/user/user_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,13 @@ export class UserImpl implements UserInternal {
}

_clone(auth: AuthInternal): UserInternal {
return new UserImpl({
const newUser = new UserImpl({
...this,
auth,
stsTokenManager: this.stsTokenManager._clone()
});
newUser.metadata._copy(this.metadata);
return newUser;
}

_onReload(callback: NextFn<APIUserInfo>): void {
Expand Down