You may have a requirement to have user activation in your solution.

The easiest way to do this is to extend the User template in the Security Tempalates.xml file by adding an additional field that will serve as an activation flag defining if the user can be logged in. After that you will add additional step to the login process pipeline and abort it if the user is not activated.

So here are the steps:

  1. Add an additional field named “Active” for the User template as you have already did for the profiles:

<field id="{E20FD18B-6F85-4A71-A086-BEE3C0546211}" name="Active" icon="" shared="1" sortorder="" source="" style="" type="checkbox" unversioned="1"/>

After that you should be able to see the Active checkbox in the User Properties window.

  1. Compile the following code and place to the *bin *folder:

using Sitecore.Pipelines.Login;

namespace WiseBusiness.Pipelines.Login
{ public class IsActive
{ public void Process(LoginArgs args)
{ // we do not want to check security for the anonymous user // also we exclude admins from this process if (Sitecore.Context.IsLoggedIn && !(Sitecore.Context.IsAdministrator) && !(Sitecore.Context.User.InnerItem["Active"] == "1"))
{ args.Success = false;
args.Warning = String.Format("Your login was not successful, the user {0} is not activated.", args.Username);
args.Abort();
} } } }

  1. Add this processor definition to the web.config below the Sitecore.Pipelines.Login.Login processor:

<login argsType="Sitecore.Pipelines.Login.LoginArgs">

... <processor mode="on" type="Sitecore.Pipelines.Login.Login, Sitecore.Kernel" /> <processor mode="on" type="WiseBusiness.Pipelines.Login.IsActive, webapp" /> ...

</login>

Notes:

  1. Developed for 5.3.1 (rev. 070417)

  2. Was not thoroughly tested, so provided "as is".