Authentication

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
15 years ago
Hello,

How is it possible to be logged in after registration?

Thanks
15 years ago
where can I define if a newly created user is logged in after creation?
15 years ago
Look at CustomerRegister control and FormsAuthentication class
15 years ago
I found this method FormsAuthentication.Authenticate but I cannot access Username Textbox and what about encrypted password? Am I supposed to do it manually?

Great Support! Gonna donate very soon!
15 years ago
TextBox txtEmail = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("UserName");
TextBox txtPassword = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Password");
15 years ago
I have put following code in createduser and creatinguser:
     TextBox txtEmail1 = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("UserName");
     TextBox txtPassword1 = (TextBox)CreateUserWizardStep1.ContentTemplateContainer.FindControl("Password");
     FormsAuthentication.Authenticate(txtEmail1.Text, txtPassword1.Text);

After those three lines user is still null: NopContext.Current.User == null

What am I doing wrong?
15 years ago
If you want to log in user after registration. Open Modules/CustomerRegister.ascx

Add LoginCreatedUser="true"

to the <asp:CreateUserWizard> control.

Your user will be logged in and redirected to Account.aspx after a successful registration.

Hope this helps,
Ben
15 years ago
Hello

Thanks for the reply! It was a part of the solution, I also had to add:
1) FormsAuthentication.SetAuthCookie(userNameTextBox.Text,false); in usercreated method
2) ContinueDestinationPageUrl="~/xxx.aspx" in customerregister.ascx

Thank you very much!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.