2
0

Membership.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. //
  2. // System.Web.Security.Membership
  3. //
  4. // Authors:
  5. // Ben Maurer ([email protected])
  6. //
  7. // (C) 2003 Ben Maurer
  8. //
  9. #if NET_1_2
  10. using System.Collections;
  11. using System.Collections.Specialized;
  12. using System.Text;
  13. namespace System.Web.Security {
  14. public sealed class Membership {
  15. public static MembershipUser CreateUser (string username, string password)
  16. {
  17. return CreateUser (username, password, null);
  18. }
  19. public static MembershipUser CreateUser (string username, string password, string email)
  20. {
  21. MembershipCreateStatus status;
  22. MembershipUser usr = CreateUser (username, password, email, out status);
  23. if (usr == null)
  24. throw new MembershipCreateUserException (status);
  25. return usr;
  26. }
  27. public static MembershipUser CreateUser (string username, string password, string email, out MembershipCreateStatus status)
  28. {
  29. return Provider.CreateUser (username, password, email, out status);
  30. }
  31. public static bool DeleteUser (string username)
  32. {
  33. return Provider.DeleteUser (username);
  34. }
  35. [MonoTODO]
  36. public static string GeneratePassword (int length)
  37. {
  38. throw new NotImplementedException ();
  39. }
  40. public static MembershipUserCollection GetAllUsers ()
  41. {
  42. return Provider.GetAllUsers ();
  43. }
  44. public static int GetNumberOfUsersOnline ()
  45. {
  46. return Provider.GetNumberOfUsersOnline ();
  47. }
  48. public static MembershipUser GetUser ()
  49. {
  50. return GetUser (HttpContext.Current.User.Identity.Name, true);
  51. }
  52. public static MembershipUser GetUser (bool userIsOnline)
  53. {
  54. return GetUser (HttpContext.Current.User.Identity.Name, userIsOnline);
  55. }
  56. public static MembershipUser GetUser (string username)
  57. {
  58. return GetUser (username, false);
  59. }
  60. public static MembershipUser GetUser (string username, bool userIsOnline)
  61. {
  62. return Provider.GetUser (username, userIsOnline);
  63. }
  64. public static string GetUserNameByEmail (string email)
  65. {
  66. return Provider.GetUserNameByEmail (email);
  67. }
  68. public static void UpdateUser (MembershipUser user)
  69. {
  70. Provider.UpdateUser (user);
  71. }
  72. public static bool ValidateUser (string username, string password)
  73. {
  74. return Provider.ValidateUser (username, password);
  75. }
  76. public static string ApplicationName {
  77. get { return Provider.ApplicationName; }
  78. set { Provider.ApplicationName = value; }
  79. }
  80. public static bool EnablePasswordReset {
  81. get { return Provider.EnablePasswordReset; }
  82. }
  83. public static bool EnablePasswordRetrieval {
  84. get { return Provider.EnablePasswordRetrieval; }
  85. }
  86. public static bool RequiresQuestionAndAnswer {
  87. get { return Provider.RequiresQuestionAndAnswer; }
  88. }
  89. [MonoTODO]
  90. public static IMembershipProvider Provider {
  91. get { throw new NotImplementedException (); }
  92. }
  93. [MonoTODO]
  94. public static MembershipProviderCollection Providers {
  95. get { throw new NotImplementedException (); }
  96. }
  97. [MonoTODO]
  98. public static int UserIsOnlineTimeWindow {
  99. get { throw new NotImplementedException (); }
  100. }
  101. }
  102. }
  103. #endif