Changeset 4005
- Timestamp:
- 07/06/10 21:31:16 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Services.Authentication Prototype/Service/Provider/HeuristicLabMembershipProvider.cs
r4004 r4005 289 289 290 290 public override string GetPassword(string username, string answer) { 291 292 throw new NotImplementedException(); 291 if (PasswordFormat == MembershipPasswordFormat.Hashed) 292 throw new NotSupportedException("Passwort is hashed"); 293 using (DataClassesDataContext db = DatabaseUtil.createDataClassesDataContext()) { 294 HeuristicLabUser u = 295 db.HeuristicLabUsers.Single<HeuristicLabUser>(x => x.UserName == username); 296 if (EnablePasswordRetrieval && RequiresQuestionAndAnswer) { 297 if (u.PasswordAnswer.Equals(answer)) { 298 return u.Password; 299 } else { 300 throw new MembershipPasswordException(); 301 } 302 } else throw new NotSupportedException("PasswortRetrival or RequiresQuestionAndAnswer not set"); 303 } 293 304 } 294 305 295 306 public override MembershipUser GetUser(string username, bool userIsOnline) { 296 throw new NotImplementedException(); 307 using (DataClassesDataContext db = DatabaseUtil.createDataClassesDataContext()) { 308 HeuristicLabUser u = 309 db.HeuristicLabUsers.Single<HeuristicLabUser>(x => x.UserName == username); 310 if (u != null) 311 return u.getMembershipUser(this.Name); 312 else 313 return null; 314 } 297 315 } 298 316 299 317 public override MembershipUser GetUser(object providerUserKey, bool userIsOnline) { 300 throw new NotImplementedException(); 318 long ID = providerUserKey is long ? (long)providerUserKey : -1; 319 using (DataClassesDataContext db = DatabaseUtil.createDataClassesDataContext()) { 320 HeuristicLabUser u = 321 db.HeuristicLabUsers.Single<HeuristicLabUser>(x => x.ID == ID); 322 if (u != null) 323 return u.getMembershipUser(this.Name); 324 else 325 return null; 326 } 301 327 } 302 328 303 329 public override string GetUserNameByEmail(string email) { 304 throw new NotImplementedException(); 305 } 306 307 330 using (DataClassesDataContext db = DatabaseUtil.createDataClassesDataContext()) { 331 HeuristicLabUser u = 332 db.HeuristicLabUsers.Single<HeuristicLabUser>(x => x.Email == email); 333 if (u != null) 334 return u.UserName; 335 else 336 return null; 337 } 338 } 308 339 309 340 public override string ResetPassword(string username, string answer) { 310 throw new Not ImplementedException();341 throw new NotSupportedException("Restet password not avaliable"); 311 342 } 312 343
Note: See TracChangeset
for help on using the changeset viewer.