Questions Ask questions on Kentico CMS 4.0 BETA or RC. This forum is closed.
Version 4.0 BETA and RC > Questions > User authentication View modes: 
User avatar
Member
Member
Peter - 1/20/2009 9:34:04 PM
   
User authentication
Hi,
I've modified the CustomSecurityHandler OnAuthentication method to get users from our external database using example from Kentico documentation.

After successfully inserting a new user, I cannot log in the user as the OnAuthentication object userInfo returns null. I'm guessing it has something to do with the password but can't see what the problem is.

If anyone can help, I would greatly appreciate it.

Here is the code I've used.

// Create base user record if user found
usr = new UserInfo();
usr.IsExternal = true;
usr.UserName = username;
usr.FullName = "John Bloke";
usr.Email = jbloke@mymail.com;
usr.Enabled = true;

// Init user sites and roles if requested
Hashtable rolesTable = new Hashtable();
string siteName = CMSContext.CurrentSite.SiteName;

// Assign user to the current site
usr.SitesRoles[siteName.ToLower()] = rolesTable;

// Add new role "external role" and assign it to the user
rolesTable["RegisteredUser"] = 0;

// Create new user
UserInfoProvider.SetUserInfo(usr);

// Set user password
UserInfoProvider.SetPassword(usr, password);


User avatar
Member
Member
Peter - 1/20/2009 9:49:02 PM
   
RE:User authentication
Actually I've just worked it out.....
IsExternal should have been false