November Happy Hour will be moved to Thursday December 5th.

Locking unused accounts

Vote:
 

I've been trying to figure out a way to block accounts that have not been used for 3 months. I've found a way to check last login date, but I'm having difficulties understanding how to mark the account as locked. I've been looking through the EPiServerProfile, but there is only a way to check if the account IS locked and unlock, not locking it.

Any ideas?

#43723
Sep 22, 2010 12:22
Vote:
 

 

            System.Web.Security.Membership.GetUser("username").IsApproved = false;

Maybe something something like this will work (not tried it myself):  

 

 

            MembershipUser user = System.Web.Security.Membership.GetUser("username");

            user.IsApproved = false;

            System.Web.Security.Membership.UpdateUser(user);

 

 

#43740
Edited, Sep 22, 2010 15:11
Vote:
 

This probably works in making the account unusable, but it does not set the IsLockedOut property to true. This is what I'm looking for.

#43857
Sep 27, 2010 12:52
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.