Skip to content

Commit 5154ed6

Browse files
committed
Explicilty set createdAt and lastLoginAt when cloning UserImpl
1 parent 7150c78 commit 5154ed6

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/auth/src/core/user/user_impl.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,9 @@ describe('core/user/user_impl', () => {
274274
uid: 'i-am-uid'
275275
}
276276
],
277-
tenantId: 'tenant-id'
277+
tenantId: 'tenant-id',
278+
createdAt: "2018-01-01 13:02:56.12345678",
279+
lastLoginAt: "2018-01-05 13:02:56.12345678"
278280
});
279281

280282
const newAuth = await testAuth();
@@ -294,6 +296,8 @@ describe('core/user/user_impl', () => {
294296
uid: 'i-am-uid'
295297
}
296298
]);
299+
expect(copy.metadata.creationTime).to.eq("2018-01-01 13:02:56.12345678");
300+
expect(copy.metadata.lastSignInTime).to.eq("2018-01-05 13:02:56.12345678");
297301
});
298302
});
299303
});

packages/auth/src/core/user/user_impl.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ export class UserImpl implements UserInternal {
142142
_clone(auth: AuthInternal): UserInternal {
143143
return new UserImpl({
144144
...this,
145+
createdAt: this.metadata.creationTime,
146+
lastLoginAt: this.metadata.lastSignInTime,
145147
auth,
146148
stsTokenManager: this.stsTokenManager._clone()
147149
});

0 commit comments

Comments
 (0)