Custom password calculation
If you want to calculate user passwords in your own way, follow this procedure. You can find more information in Customizing providers.
Open your Kentico solution in Visual Studio.
Create a new Class Library project in the Kentico solution (or reuse an existing custom project).
Add references to the required Kentico libraries (DLLs) for the new project.
Reference the custom project from the Kentico web project (CMSApp or CMS).
Edit the project’s AssemblyInfo.cs file (in the Properties folder).
Add the AssemblyDiscoverable assembly attribute:
using CMS; [assembly:AssemblyDiscoverable]
Create a new class within the custom project.
Set the class to inherit from the UserInfoProvider class.
Override the GetPasswordHashInternal method.
Add the RegisterCustomProvider assembly attribute above the class declaration to register the provider.
using System; using System.Collections.Generic; using System.Linq; using System.Web; using CMS; using CMS.Helpers; using CMS.Membership; // Registers the custom provider [assembly: RegisterCustomProvider(typeof(MyUserInfoProvider))] /// <summary> /// Customized UserInfoProvider for password calculation. /// </summary> public class MyUserInfoProvider : UserInfoProvider { protected override string GetPasswordHashInternal(string password, string passwordFormat, string salt) { return SecurityHelper.GetSHA1Hash(password + "CustomSalt"); } }
If you are utilizing the MVC development model, also deploy the custom project to your separate MVC application.
The system now uses the customized provider (MyUserInfoProvider) instead of the default one.