Changeset 4009 for branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabMembershipProvider.cs
- Timestamp:
- 07/07/10 03:26:15 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabMembershipProvider.cs
r4008 r4009 22 22 private bool pRequiresQuestionAndAnswer; 23 23 private bool pRequiresUniqueEmail; 24 private int pMaxInvalidPasswordAttempts ;24 private int pMaxInvalidPasswordAttempts = 3; 25 25 private int pPasswordAttemptWindow; 26 26 private int pMinRequiredPasswordLength = 5; … … 69 69 70 70 public override bool RequiresQuestionAndAnswer { 71 get { return pRequiresQuestionAndAnswer; }71 get { return false; } 72 72 } 73 73 … … 163 163 u.PasswordAnswer = newPasswordAnswer; 164 164 u.PasswordQuestion = newPasswordQuestion; 165 165 166 db.SubmitChanges(); 167 166 168 return true; 167 169 } … … 432 434 return false; 433 435 } 434 HeuristicLabUser u = db.HeuristicLabUsers.Single(x => x.UserName == username); 435 isValid = CheckPassword(password, u.Password); 436 if (db.HeuristicLabUsers.Count(x => x.UserName == username && x.Locked == false) > 0) { 437 HeuristicLabUser u = db.HeuristicLabUsers.Single(x => x.UserName == username && x.Locked == false); 438 isValid = CheckPassword(password, u.Password) && u.FailedLogins <= MaxInvalidPasswordAttempts; 439 if (!isValid) { 440 u.FailedLogins++; 441 if (u.FailedLogins > MaxInvalidPasswordAttempts) { 442 u.Locked = true; 443 } 444 } else { 445 u.FailedLogins = 0; 446 } 447 448 db.SubmitChanges(); 449 } 436 450 } 437 451 return isValid;
Note: See TracChangeset
for help on using the changeset viewer.