C# Class Worki.Memberships.WorkiMembershipProvider

Inheritance: System.Web.Security.MembershipProvider
Afficher le fichier Open project: tah91/eworkyWebSite

Private Properties

Свойство Type Description
CheckPassword bool
EncodePassword string
GeneratePassword string
GenerateSalt string
GetConfigValue string
GetUserFromMember System.Web.Security.MembershipUser
HexToByte byte[]
ResetAuthenticationFailures void
UnEncodePassword string

Méthodes publiques

Méthode Description
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

Private Methods

Méthode Description
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.

Method Details

ChangePassword() public méthode

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
Résultat bool

ChangePasswordQuestionAndAnswer() public méthode

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)
Résultat bool

CreateUser() public méthode

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
Résultat System.Web.Security.MembershipUser

DeleteUser() public méthode

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
Résultat bool

FindUsersByEmail() public méthode

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
Résultat System.Web.Security.MembershipUserCollection

FindUsersByName() public méthode

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
Résultat System.Web.Security.MembershipUserCollection

GetAllUsers() public méthode

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
Résultat System.Web.Security.MembershipUserCollection

GetNumberOfUsersOnline() public méthode

Gets the total number of users that are currently online.
public GetNumberOfUsersOnline ( ) : int
Résultat int

GetPassword() public méthode

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
Résultat string

GetUser() public méthode

Gets a MembershipUser object with a given key
public GetUser ( object providerUserKey, bool userIsOnline ) : System.Web.Security.MembershipUser
providerUserKey object
userIsOnline bool
Résultat System.Web.Security.MembershipUser

GetUser() public méthode

Gets a MembershipUser object with a given username
public GetUser ( string username, bool userIsOnline ) : System.Web.Security.MembershipUser
username string
userIsOnline bool
Résultat System.Web.Security.MembershipUser

GetUserNameByEmail() public méthode

Gets the username by a given matching email address
public GetUserNameByEmail ( string email ) : string
email string
Résultat string

Initialize() public méthode

public Initialize ( string name, System config ) : void
name string
config System
Résultat void

ResetPassword() public méthode

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
Résultat string

UnlockUser() public méthode

Unlocks a user (after too many login attempts perhaps)
public UnlockUser ( string userName ) : bool
userName string Username to unlock
Résultat bool

UpdateUser() public méthode

Updates an existing user with new settings
public UpdateUser ( System.Web.Security.MembershipUser user ) : void
user System.Web.Security.MembershipUser MembershipUser object to modify
Résultat void

ValidateUser() public méthode

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
Résultat bool