C# Класс Worki.Memberships.WorkiMembershipProvider

Наследование: System.Web.Security.MembershipProvider
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
CheckPassword bool
EncodePassword string
GeneratePassword string
GenerateSalt string
GetConfigValue string
GetUserFromMember System.Web.Security.MembershipUser
HexToByte byte[]
ResetAuthenticationFailures void
UnEncodePassword string

Открытые методы

Метод Описание
ChangePassword ( string username, string oldPassword, string newPassword ) : bool

Change the current password for a new one. Note: Both are required.

ChangePasswordQuestionAndAnswer ( string username, string password, string newPasswordQuestion, string newPasswordAnswer ) : bool

Change the password retreival/reset question and answer pair

CreateUser ( string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, MembershipCreateStatus &status ) : System.Web.Security.MembershipUser

Creates a new user with a given set of default values

DeleteUser ( string username, bool deleteAllRelatedData ) : bool

Permanently deletes a user from the database

FindUsersByEmail ( string emailToMatch, int pageIndex, int pageSize, int &totalRecords ) : System.Web.Security.MembershipUserCollection

Finds a list of users with a matching email address

FindUsersByName ( string usernameToMatch, int pageIndex, int pageSize, int &totalRecords ) : System.Web.Security.MembershipUserCollection

Gets a list of users with a matching username

GetAllUsers ( int pageIndex, int pageSize, int &totalRecords ) : System.Web.Security.MembershipUserCollection

Gets all the users in the database

GetNumberOfUsersOnline ( ) : int

Gets the total number of users that are currently online.

GetPassword ( string username, string answer ) : string

Gets the current password of a user (provided it isn't hashed)

GetUser ( object providerUserKey, bool userIsOnline ) : System.Web.Security.MembershipUser

Gets a MembershipUser object with a given key

GetUser ( string username, bool userIsOnline ) : System.Web.Security.MembershipUser

Gets a MembershipUser object with a given username

GetUserNameByEmail ( string email ) : string

Gets the username by a given matching email address

Initialize ( string name, System config ) : void
ResetPassword ( string username, string answer ) : string

Resets the passwords with a generated value

UnlockUser ( string userName ) : bool

Unlocks a user (after too many login attempts perhaps)

UpdateUser ( System.Web.Security.MembershipUser user ) : void

Updates an existing user with new settings

ValidateUser ( string username, string password ) : bool

Authenticates a user with the given username and password

Приватные методы

Метод Описание
CheckPassword ( string password, string dbpassword, string dbsalt ) : bool

Compares a given password with one stored in the database and an optional salt

EncodePassword ( string password ) : string

Encodes a given password using the default MembershipPasswordFormat setting

GeneratePassword ( int passLength ) : string

Generates a random password of given length (MinRequiredPasswordLength)

GenerateSalt ( ) : string

Salt generation helper (this is essentially the same as the one in SqlMembershipProviders

GetConfigValue ( string configValue, string defaultValue ) : string

Used in the initializtion, key in web.config or the default setting if null.

GetUserFromMember ( Member m ) : System.Web.Security.MembershipUser

Converts a Member object into a MembershipUser object using its assigned settings

HexToByte ( string hexString ) : byte[]

Converts a string into a byte array

ResetAuthenticationFailures ( Member &m, System.DateTime dt ) : void

Upon a successful login or password reset, this changes all the previous failure markers to defaults.

UnEncodePassword ( string encodedPassword ) : string

Decodes a given stored password into a cleartype or unencrypted form. Provided it isn't hashed.

Описание методов

ChangePassword() публичный Метод

Change the current password for a new one. Note: Both are required.
public ChangePassword ( string username, string oldPassword, string newPassword ) : bool
username string Username the password is being changed for
oldPassword string Old password to verify owner
newPassword string New password
Результат bool

ChangePasswordQuestionAndAnswer() публичный Метод

Change the password retreival/reset question and answer pair
public ChangePasswordQuestionAndAnswer ( string username, string password, string newPasswordQuestion, string newPasswordAnswer ) : bool
username string Username the question and answer are being changed for
password string Current password
newPasswordQuestion string New password question
newPasswordAnswer string New password answer (will also be encrypted)
Результат bool

CreateUser() публичный Метод

Creates a new user with a given set of default values
public CreateUser ( string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, MembershipCreateStatus &status ) : System.Web.Security.MembershipUser
username string
password string
email string
passwordQuestion string
passwordAnswer string
isApproved bool
providerUserKey object
status MembershipCreateStatus
Результат System.Web.Security.MembershipUser

DeleteUser() публичный Метод

Permanently deletes a user from the database
public DeleteUser ( string username, bool deleteAllRelatedData ) : bool
username string Username to delete
deleteAllRelatedData bool Should or shouldn't delete related user data
Результат bool

FindUsersByEmail() публичный Метод

Finds a list of users with a matching email address
public FindUsersByEmail ( string emailToMatch, int pageIndex, int pageSize, int &totalRecords ) : System.Web.Security.MembershipUserCollection
emailToMatch string Given email to search
pageIndex int Current page index
pageSize int Number of results per page
totalRecords int Total number of users returned
Результат System.Web.Security.MembershipUserCollection

FindUsersByName() публичный Метод

Gets a list of users with a matching username
public FindUsersByName ( string usernameToMatch, int pageIndex, int pageSize, int &totalRecords ) : System.Web.Security.MembershipUserCollection
usernameToMatch string Username to search for
pageIndex int Current page index
pageSize int Number of results per page
totalRecords int Total number of users returned
Результат System.Web.Security.MembershipUserCollection

GetAllUsers() публичный Метод

Gets all the users in the database
public GetAllUsers ( int pageIndex, int pageSize, int &totalRecords ) : System.Web.Security.MembershipUserCollection
pageIndex int Current page index
pageSize int Number of results per page
totalRecords int Total number of users returned
Результат System.Web.Security.MembershipUserCollection

GetNumberOfUsersOnline() публичный Метод

Gets the total number of users that are currently online.
public GetNumberOfUsersOnline ( ) : int
Результат int

GetPassword() публичный Метод

Gets the current password of a user (provided it isn't hashed)
public GetPassword ( string username, string answer ) : string
username string User the password is being retrieved for
answer string Password retrieval answer
Результат string

GetUser() публичный Метод

Gets a MembershipUser object with a given key
public GetUser ( object providerUserKey, bool userIsOnline ) : System.Web.Security.MembershipUser
providerUserKey object
userIsOnline bool
Результат System.Web.Security.MembershipUser

GetUser() публичный Метод

Gets a MembershipUser object with a given username
public GetUser ( string username, bool userIsOnline ) : System.Web.Security.MembershipUser
username string
userIsOnline bool
Результат System.Web.Security.MembershipUser

GetUserNameByEmail() публичный Метод

Gets the username by a given matching email address
public GetUserNameByEmail ( string email ) : string
email string
Результат string

Initialize() публичный Метод

public Initialize ( string name, System config ) : void
name string
config System
Результат void

ResetPassword() публичный Метод

Resets the passwords with a generated value
public ResetPassword ( string username, string answer ) : string
username string User the password is being reset for
answer string Password retrieval answer
Результат string

UnlockUser() публичный Метод

Unlocks a user (after too many login attempts perhaps)
public UnlockUser ( string userName ) : bool
userName string Username to unlock
Результат bool

UpdateUser() публичный Метод

Updates an existing user with new settings
public UpdateUser ( System.Web.Security.MembershipUser user ) : void
user System.Web.Security.MembershipUser MembershipUser object to modify
Результат void

ValidateUser() публичный Метод

Authenticates a user with the given username and password
public ValidateUser ( string username, string password ) : bool
username string Login password
password string The login username
Результат bool