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

Lockout doesn't work #15

Open
ha-kiss opened this issue Aug 2, 2017 · 2 comments
Open

Lockout doesn't work #15

ha-kiss opened this issue Aug 2, 2017 · 2 comments
Assignees
Labels

Comments

@ha-kiss
Copy link

ha-kiss commented Aug 2, 2017

Hi,

Loved your code. Very helpful.

One issue had me puzzled for sometime now. The user lockout (after x tries) does not work.
After debugging your code I found that the following code should be fixed wherever it occurs in UsetTable.cs

user.LockoutEndDateUtc = string.IsNullOrEmpty(row["LOCKOUTENDDATEUTC"]) ? DateTime.Now : DateTime.Parse(row["LOCKOUTENDDATEUTC"]);
should be
user.LockoutEndDateUtc = string.IsNullOrEmpty(row["LOCKOUTENDDATEUTC"]) ? DateTime.UtcNow : DateTime.Parse(row["LOCKOUTENDDATEUTC"]);

Hope I helped a bit.

Best regards,

Harris

@arichika
Copy link
Owner

arichika commented Aug 2, 2017

oh.. great works. thank you.
I will fix it and marge at later.

@arichika arichika self-assigned this Aug 2, 2017
@arichika arichika added the bug label Aug 2, 2017
@ha-kiss
Copy link
Author

ha-kiss commented Aug 2, 2017

It turns out my code does not work either :-)

The date to return must be in the past. If you set it to DateTime.UtcNow it is considered current when it's checked later in the code since the code gets executed within the same second. In my tests I had a breakpoint that delayed the execution for more than 1 second so that's why I though everything worked fine.

A better approach is to make sure the returned date is in the past like this:
DateTime.UtcNow.AddDays(-5)

The above code works fine in all scenarios.

Best regards,

Harris

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants