Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/06/10 16:01:19 (14 years ago)
Author:
bfarka
Message:

made struture changes in persistence classes and provider

Location:
branches/HeuristicLab.Services.Authentication Prototype/Persistence
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Services.Authentication Prototype/Persistence/HeuristicLabUser.cs

    r3992 r4002  
    66  /// implements the MembershipUser for HeuristicLab
    77  /// </summary>
    8   partial class HeuristicLabUser : MembershipUser {
     8  partial class HeuristicLabUser {
     9
     10    private HeuristicLabMembershipUser membershipUser;
     11   
    912    public HeuristicLabUser(string name, string email, string passwordQuestion, string comment) : this() {
    1013      _UserName = name;
     
    1720    }
    1821
    19     public override bool ChangePassword(string oldPassword, string newPassword) {
    20       if (oldPassword == null) {
    21         throw new ArgumentNullException("oldPassword");
     22
     23
     24    public  HeuristicLabMembershipUser getMembershipUser(String providerName) {
     25      if (membershipUser == null) {
     26        membershipUser = new HeuristicLabMembershipUser(providerName, this.UserName, this.ID, this.Email, this.PasswordQuestion, this.Comment, true, this.Locked, new DateTime(), new DateTime(), new DateTime(), new DateTime(), new DateTime()) ;
    2227      }
    23       if (newPassword == null) {
    24         throw new ArgumentNullException("newPassword");
    25       }
    26       if (oldPassword.Length == 0) {
    27         throw new ArgumentException("Parameter oldPassword must not be empty!");
    28       }
    29       if (newPassword.Length == 0) {
    30         throw new ArgumentException("Parameter newPassword must not be empty!");
    31       }
    32 
    33       if (Password.CompareTo(oldPassword) == 0) {
    34         Password = newPassword;
    35         return true;
    36       } else {
    37         return false;
    38       }
     28      return membershipUser;
    3929    }
    40 
    41     public override bool ChangePasswordQuestionAndAnswer(string password, string newPasswordQuestion, string newPasswordAnswer) {
    42       if (password == null) {
    43         throw new ArgumentNullException("password");
    44       }
    45       if (newPasswordQuestion == null) {
    46         throw new ArgumentNullException("newPasswordQuestion");
    47       }
    48       if (newPasswordAnswer == null) {
    49         throw new ArgumentNullException("newPasswordAnswer");
    50       }
    51       if (password.Length == 0) {
    52         throw new ArgumentException("Parameter password must not be empty!");
    53       }
    54       if (newPasswordQuestion.Length == 0) {
    55         throw new ArgumentException("Parameter newPasswordQuestion must not be empty!");
    56       }
    57       if (newPasswordAnswer.Length == 0) {
    58         throw new ArgumentException("Parameter newPasswordAnswer must not be empty!");
    59       }
    60 
    61       if (Password.CompareTo(password) == 0) {
    62         _PasswordQuestion = newPasswordQuestion;
    63         PasswordAnswer = newPasswordAnswer;
    64         return true;
    65       } else {
    66         return false;
    67       }
    68     }
    69 
    70     public override string GetPassword() {
    71       return Password;
    72     }
    73 
    74     public override string GetPassword(string passwordAnswer) {
    75       if (PasswordAnswer == passwordAnswer) {
    76         return Password;
    77       } else {
    78         return "";
    79       }
    80     }
    81 
    82     public override string ResetPassword() {
    83       Password = "INIT";
    84       return Password;
    85     }
    86 
    87     public override string ResetPassword(string passwordAnswer) {
    88       if (PasswordAnswer == passwordAnswer) {
    89         Password = "INIT";
    90         return Password;
    91       } else {
    92         return "";
    93       }
    94     }
    95 
    96     public override string ToString() {
    97       return UserName;
    98     }
    99 
    100     public bool LockUser()
    101     {
    102         Locked = true;
    103         return Locked;
    104     }
    105 
    106     //
    107     // Summary:
    108     //     Clears the locked-out state of the user so that the membership user can be
    109     //     validated.
    110     //
    111     // Returns:
    112     //     true if the membership user was successfully unlocked; otherwise, false.
    113     public override bool UnlockUser()
    114     {
    115         Locked = false;
    116         return !Locked;
    117     }
     30   
    11831  }
    11932}
  • branches/HeuristicLab.Services.Authentication Prototype/Persistence/HeuristicLabUserRole.cs

    r3978 r4002  
    77  partial class HeuristicLabUserRole {
    88    public override bool Equals(object obj) {
    9         if(this.ID == null ^ ((HeuristicLabUserRole)obj).ID == null )
    10         {
    11           return false;
    12         }
    13         else if (this.ID == null && ((HeuristicLabUserRole)obj).ID == null)
     9       if (this.ID == null && ((HeuristicLabUserRole)obj).ID == null)
    1410        {
    1511         return base.Equals(obj);
  • branches/HeuristicLab.Services.Authentication Prototype/Persistence/Persistence.csproj

    r3970 r4002  
    5353  </ItemGroup>
    5454  <ItemGroup>
     55    <Compile Include="HeuristicLabMembershipUser.cs" />
    5556    <Compile Include="HeuristicLabUserRole.cs" />
    5657    <Compile Include="DatabaseUtil.cs" />
Note: See TracChangeset for help on using the changeset viewer.