Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/07/10 03:26:15 (14 years ago)
Author:
bfarka
Message:

fixed bugs in membership provider 32 out of 43 tests are now passing.. (#1046)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabMembershipProvider.cs

    r4008 r4009  
    2222    private bool pRequiresQuestionAndAnswer;
    2323    private bool pRequiresUniqueEmail;
    24     private int pMaxInvalidPasswordAttempts;
     24    private int pMaxInvalidPasswordAttempts = 3;
    2525    private int pPasswordAttemptWindow;
    2626    private int pMinRequiredPasswordLength = 5;
     
    6969
    7070    public override bool RequiresQuestionAndAnswer {
    71       get { return pRequiresQuestionAndAnswer; }
     71      get { return false; }
    7272    }
    7373
     
    163163          u.PasswordAnswer = newPasswordAnswer;
    164164          u.PasswordQuestion = newPasswordQuestion;
     165         
    165166          db.SubmitChanges();
     167         
    166168          return true;
    167169        }
     
    432434          return false;
    433435        }
    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        }
    436450      }
    437451      return isValid;
Note: See TracChangeset for help on using the changeset viewer.