Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...C# - Issues with Persisting Login with Custom Registration formC# - Issues with Persisting Login with Custom Registration form
Previous
 
Next
New Post
8/11/2009 9:28 AM
 
I am having some problems with my custom registration form and getting authentication cookies set... My registration form is a MultiView control with two View controls. The first View control contains the actual form, the second contains a message with a link that directs them to the home page. The registration form works; I am able to save my login data within DNN's tables (as well as my other custom tables) and UserCreateStatus returns SUCCESS. However, when the user clicks to go to Home, the Register/Login links are still shown and none of my modules tied to the login role will display unless the user logs in with their saved data.

Code is attached below in C#. The object "c" is my custom object that inherits from UserInfo.

DotNetNuke.Security.Membership.UserCreateStatus ucs = new DotNetNuke.Security.Membership.UserCreateStatus();
DotNetNuke.Entities.Users.UserInfo ui = (DotNetNuke.Entities.Users.UserInfo)c;
DotNetNuke.Entities.Portals.PortalSettings myPortalSettings = new DotNetNuke.Entities.Portals.PortalSettings();

ui.PortalID = myPortalSettings.PortalId;
ui.IsSuperUser = false;
ui.Membership.CreatedDate = DateTime.Now;
ui.Username = this.txtEmail.Text;
ui.Membership.Password = this.txtPass.Text;
ui.Membership.UpdatePassword = false;
ui.DisplayName = this.txtFName.Text + " " + this.txtLName.Text;
ui.Roles = new string[] {"Registered Users"};
ui.Membership.Approved = true;

ucs = DotNetNuke.Entities.Users.UserController.CreateUser(ref ui);
DotNetNuke.Entities.Users.UserController.SetAuthCookie(this.txtEmail.Text, true);

if (ucs == DotNetNuke.Security.Membership.UserCreateStatus.Success)
{
UserLoginStatus uls = UserLoginStatus.LOGIN_SUCCESS;
ui = DotNetNuke.Entities.Users.UserController.ValidateUser(myPortalSettings.PortalId, this.txtEmail.Text, this.txtPass.Text, "DNN", "", myPortalSettings.PortalName, AuthenticationLoginBase.GetIPAddress(), ref uls);

UserAuthenticatedEventArgs evtArgs = new UserAuthenticatedEventArgs(ui, this.txtEmail.Text, uls, "DNN");
evtArgs.Authenticated = true;
evtArgs.LoginStatus = uls;

OnUserAuthenticated(evtArgs);
}


I started assigning the flags and explicitly created the auth cookies manually thinking I was missing something in the login process but that hasn't helped.

 
New Post
10/20/2009 2:34 PM
 

 I am having a horrible time trying to customize a dnn login script as well...

The only line I see that I have that you don't is this... perhaps this will help:

DotNetNuke.Entities.Users.UserController.UserLogin(PortalId, objUserInfo, strPortalName, Request.ServerVariables["REMOTE_ADDR"].ToString(), true);

 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...C# - Issues with Persisting Login with Custom Registration formC# - Issues with Persisting Login with Custom Registration form


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out