- Timestamp:
- 07/06/10 16:01:19 (14 years ago)
- 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 6 6 /// implements the MembershipUser for HeuristicLab 7 7 /// </summary> 8 partial class HeuristicLabUser : MembershipUser { 8 partial class HeuristicLabUser { 9 10 private HeuristicLabMembershipUser membershipUser; 11 9 12 public HeuristicLabUser(string name, string email, string passwordQuestion, string comment) : this() { 10 13 _UserName = name; … … 17 20 } 18 21 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()) ; 22 27 } 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; 39 29 } 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 118 31 } 119 32 } -
branches/HeuristicLab.Services.Authentication Prototype/Persistence/HeuristicLabUserRole.cs
r3978 r4002 7 7 partial class HeuristicLabUserRole { 8 8 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) 14 10 { 15 11 return base.Equals(obj); -
branches/HeuristicLab.Services.Authentication Prototype/Persistence/Persistence.csproj
r3970 r4002 53 53 </ItemGroup> 54 54 <ItemGroup> 55 <Compile Include="HeuristicLabMembershipUser.cs" /> 55 56 <Compile Include="HeuristicLabUserRole.cs" /> 56 57 <Compile Include="DatabaseUtil.cs" />
Note: See TracChangeset
for help on using the changeset viewer.