Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly set createdAt and lastLoginAt when cloning UserImpl #7066

Merged
merged 4 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 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,8 @@ describe('core/user/user_impl', () => {
uid: 'i-am-uid'
}
]);
expect(copy.metadata.creationTime).to.eq("2018-01-01 13:02:56.12345678");
expect(copy.metadata.lastSignInTime).to.eq("2018-01-05 13:02:56.12345678");
});
});
});
2 changes: 2 additions & 0 deletions packages/auth/src/core/user/user_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ export class UserImpl implements UserInternal {
_clone(auth: AuthInternal): UserInternal {
return new UserImpl({
...this,
createdAt: this.metadata.creationTime,
mdedys marked this conversation as resolved.
Show resolved Hide resolved
lastLoginAt: this.metadata.lastSignInTime,
auth,
stsTokenManager: this.stsTokenManager._clone()
});
Expand Down