Closed TFAstudio closed 1 year ago
Hi there @TFAstudio!
Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.
We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.
We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.
Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:
I was able to reproduce the issue in V12.0.0
Hi thanks for reporting and confirmation. I have a hard time reproducing, but maybe it's because my server is in same timezone as my user. Did you reproduce with a local server or only on hosting?
@bergmania I reproduced it locally. The issue is that in the PostSetInvitedUserPassword method of the CurrentUserController the LastLoginDate is being assigned the DateTime.UtcNow. From what I've seen in the CMS code, the LastLoginDate is always assigned the local time and not UTC.
I'll try to fix this later today and create a PR.
@bergmania do you know why is the user being saved using the _userService.Save instead of _backOfficeUserManager.UpdateAsync? Is there any specific reason for this? or can I replace?
@bergmania do you know why is the user being saved using the _userService.Save instead of _backOfficeUserManager.UpdateAsync? Is there any specific reason for this? or can I replace?
No, I don't know why it uses _userService here. For the upcoming v14, we have managed to hide all the knowledge of the user stores, so all interaction have to be through the service.
@bergmania ok, I'll try to fix this by assigning the DateTime.UtcNow to LastLoginDateUtc and save the user via _backOfficeUserManager.UpdateAsync
Created PR 14619 to fix this issue.
@bergmania I tried to keep the changes to a minimum but I suggested an improvement in the PR description. Please check and let me know if I should apply it.
Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)
10.6.1
Bug summary
The 1st back-office login by any new Umbraco User does not accurately reflect the local time of that user's device nor that of the hosting environment. The "Last login:" is wrong.
Specifics
Wrong time is displayed. Out by -10 hours here in Australia. So perhaps it is writing as UTC or GMT instead of local.
Note: Subsequent logins show the correct time.
Steps to reproduce
Expected result / actual result
The Last login time should always be accurate.
First login:
2nd login immediately afterwards: