admin
-
12/28/2006 3:54:48 PM
Re: how to create user registration page.
Hello,
Thank you for your message. You need to build a standard ASPX form and use Kentico CMS API to create users and assign them to chosen roles (if required).
using Kentico.CMS.DataEngine; ...
DataClass userObj = new DataClass(“cms.user”); userObj.SetValue(“username”, “johns”); userObj.SetValue(“fullname”, “John Smith”); userObj.Insert();
GeneralConnection cn = new GeneralConnection(); object[,] paramsIdent = new object[ 2, 3 ]; paramsIdent[ 0, 0 ] = "@UserID"; paramsIdent[ 0, 1 ] = userObj.GetValue("userid"); paramsIdent[ 1, 0 ] = "@RoleID"; paramsIdent[ 1, 1 ] = roleId; //set appropriate value here cn.ExecuteQuery( "CMS.User.AddToRole", paramsIdent );
If the account needs to be activated, you can create the account with some temporary (secret) password and set it to a new password (e.g. blank password) when the user clicks the activation link in the e-mail that you sent during the registration process. The link will point to your custom page that will reset the password.
Best Regards,
|