I have create an account in mvc4 using the websecurity class as follow :
WebSecurity.CreateUserAndAccount(model.UserName, model.Password,
new {
EmailAddress = model.EmailAddress,
ContactNo = model.ContactNo,
Password = model.Password
});
My user have created successfully ... now i want to : activate/deactivate a user whenever i wish.
so that user login only if his account is active otherwise he shouldn't be able to login .
How can i achieve this?
You can use
UserProfile
class for do it. This class located in theAccountModels
class which acts as a profile table for each user account. It is here that you'd typically want to include a property namedIsActive
.You can change
IsActive
property and check it inlogin
action.See this post for more information.