2 // System.Web.Security.Membership
5 // Ben Maurer (bmaurer@users.sourceforge.net)
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System
.Collections
;
33 using System
.Collections
.Specialized
;
36 namespace System
.Web
.Security
{
37 public sealed class Membership
{
39 public static MembershipUser
CreateUser (string username
, string password
)
41 return CreateUser (username
, password
, null);
44 public static MembershipUser
CreateUser (string username
, string password
, string email
)
46 MembershipCreateStatus status
;
47 MembershipUser usr
= CreateUser (username
, password
, email
, out status
);
49 throw new MembershipCreateUserException (status
);
54 public static MembershipUser
CreateUser (string username
, string password
, string email
, out MembershipCreateStatus status
)
56 return Provider
.CreateUser (username
, password
, email
, out status
);
59 public static bool DeleteUser (string username
)
61 return Provider
.DeleteUser (username
);
65 public static string GeneratePassword (int length
)
67 throw new NotImplementedException ();
70 public static MembershipUserCollection
GetAllUsers ()
72 return Provider
.GetAllUsers ();
75 public static int GetNumberOfUsersOnline ()
77 return Provider
.GetNumberOfUsersOnline ();
80 public static MembershipUser
GetUser ()
82 return GetUser (HttpContext
.Current
.User
.Identity
.Name
, true);
85 public static MembershipUser
GetUser (bool userIsOnline
)
87 return GetUser (HttpContext
.Current
.User
.Identity
.Name
, userIsOnline
);
90 public static MembershipUser
GetUser (string username
)
92 return GetUser (username
, false);
95 public static MembershipUser
GetUser (string username
, bool userIsOnline
)
97 return Provider
.GetUser (username
, userIsOnline
);
100 public static string GetUserNameByEmail (string email
)
102 return Provider
.GetUserNameByEmail (email
);
105 public static void UpdateUser (MembershipUser user
)
107 Provider
.UpdateUser (user
);
110 public static bool ValidateUser (string username
, string password
)
112 return Provider
.ValidateUser (username
, password
);
115 public static string ApplicationName
{
116 get { return Provider.ApplicationName; }
117 set { Provider.ApplicationName = value; }
120 public static bool EnablePasswordReset
{
121 get { return Provider.EnablePasswordReset; }
124 public static bool EnablePasswordRetrieval
{
125 get { return Provider.EnablePasswordRetrieval; }
128 public static bool RequiresQuestionAndAnswer
{
129 get { return Provider.RequiresQuestionAndAnswer; }
133 public static IMembershipProvider Provider
{
134 get { throw new NotImplementedException (); }
138 public static MembershipProviderCollection Providers
{
139 get { throw new NotImplementedException (); }
143 public static int UserIsOnlineTimeWindow
{
144 get { throw new NotImplementedException (); }