Uma
 Nuke Active Member Posts:27

 |
| 07/29/2008 8:05 AM |
|
Hi,
I am registering an user thru coding
Code Sample:
NewUser.Username = txtEmail.Text NewUser.Membership.Password = UserController.GeneratePassword()
Dim createStatus As UserCreateStatus = UserController.CreateUser(NewUser) User is also registered properly. I have verified the database also.
If
I try to logon with this username and password, I am getting the error
message as "Login Failed." (Validateuser function is returning false)
Can you let me know a way to solve this?
Thanks, Uma
|
|
|
|
|
Joseph Craig DNN MVP Posts:11667

 |
| 07/29/2008 8:12 AM |
|
Here is a chunk of code I found in a blog posting by John Mitchell:
Dim oUserInfo As New UserInfo oUserInfo.PortalID = 0 oUserInfo.Membership.Username = GetXmlItemValue(xmlItem, "Username") oUserInfo.Username = GetXmlItemValue(xmlItem, "Username") oUserInfo.Profile.FirstName = GetXmlItemValue(xmlItem, "FirstName") oUserInfo.FirstName = GetXmlItemValue(xmlItem, "FirstName") oUserInfo.Profile.LastName = GetXmlItemValue(xmlItem, "LastName") oUserInfo.LastName = GetXmlItemValue(xmlItem, "LastName") oUserInfo.Profile.Unit = GetXmlItemValue(xmlItem, "Unit") oUserInfo.Profile.Street = GetXmlItemValue(xmlItem, "Street") oUserInfo.Profile.City = GetXmlItemValue(xmlItem, "City") oUserInfo.Profile.Region = GetXmlItemValue(xmlItem, "Region") oUserInfo.Profile.PostalCode = GetXmlItemValue(xmlItem, "PostalCode") oUserInfo.Profile.Country = GetXmlItemValue(xmlItem, "Country") oUserInfo.Profile.Telephone = GetXmlItemValue(xmlItem, "Telephone") oUserInfo.Membership.Email = GetXmlItemValue(xmlItem, "Email") oUserInfo.Email = GetXmlItemValue(xmlItem, "Email") oUserInfo.Membership.Approved = True oUserInfo.AffiliateID = Null.NullInteger oUserInfo.Membership.Password = GetXmlItemValue(xmlItem, "Password") Dim createStatus As UserCreateStatus = UserController.CreateUser(oUserInfo) If createStatus = UserCreateStatus.Success Then responseBuilder.Append(String.Format("User '{0}' created successfully", oUserInfo.Username)) Else responseBuilder.Append(String.Format("User '{0}' creation failed: {1}", oUserInfo.Username, [Enum].GetName(GetType(UserCreateStatus), createStatus))) End If
Perhaps thinks like PortalID, Email, AffiliateID are necessary ...
|
|
Joe Craig, Patapsco Research Group Complete DNN Support |
|
|
Uma
 Nuke Active Member Posts:27

 |
| 07/29/2008 8:18 AM |
|
Joe,
Thanks for your reply.
As like the sample code, I am also passing all the mandatory fields and user is also created succesfully. But when I attempt to login with this username and system genrated password, I get the error "Login failed"
Please advice
Uma. |
|
|
|
|
Joseph Craig DNN MVP Posts:11667

 |
| 07/29/2008 8:20 AM |
|
Have you tried using the "Forgot Password" link and using the password that is sent to you? |
|
Joe Craig, Patapsco Research Group Complete DNN Support |
|
|
Uma
 Nuke Active Member Posts:27

 |
| 07/29/2008 8:39 AM |
|
Yes. I tried forgot password also. Still login fails.
|
|
|
|
|
Joseph Craig DNN MVP Posts:11667

 |
| 07/29/2008 8:43 AM |
|
Are you able to login with the Host and Admin accounts? |
|
Joe Craig, Patapsco Research Group Complete DNN Support |
|
|
Uma
 Nuke Active Member Posts:27

 |
| 07/29/2008 8:47 AM |
|
I am able to login as host and all the registered users logins are working fine.
The only thing is that the user created thru coding is not logging in.
|
|
|
|
|
Joseph Craig DNN MVP Posts:11667

 |
| 07/29/2008 8:57 AM |
|
OK, then the problem is in your code that creates the user ... obviously! If you want to post the entire snippet of code, do that or attach a file. It's hard to debug without being able to see everything. |
|
Joe Craig, Patapsco Research Group Complete DNN Support |
|
|
Uma
 Nuke Active Member Posts:27

 |
| 07/30/2008 5:10 AM |
|
I am pasting my code to create an user
Dim NewUser As New UserInfo() NewUser.PortalID = PortalId NewUser.Membership.Username = tbEmail.Text NewUser.Username = tbEmail.Text NewUser.Profile.FirstName = tbFirstName.Text NewUser.FirstName = tbFirstName.Text NewUser.Profile.LastName = tbLastName.Text NewUser.LastName = tbLastName.Text NewUser.Email = tbEmail.Text NewUser.Membership.Email = tbEmail.Text NewUser.DisplayName = tbFirstName.Text & NewUser.AffiliateID = Null.NullInteger NewUser.Membership.Approved = True NewUser.Membership.Password = "password" Dim createStatus As UserCreateStatus = UserController.CreateUser(NewUser)
If I edit the user's in Admin->User Account, I can able to login successfully.
Please let me know where the problem is.
Thanks Uma |
|
|
|
|
Joseph Craig DNN MVP Posts:11667

 |
| 07/30/2008 7:37 AM |
|
You might want to look at what is returned by CreateUser. Also, you say that after editing the user's account, you can login. What do you edit in the user's account to make this happen? |
|
Joe Craig, Patapsco Research Group Complete DNN Support |
|
|
Uma
 Nuke Active Member Posts:27

 |
| 07/30/2008 7:57 AM |
|
In Admin -> User Account, I have changed the password and logged in with this new password successfuly.
CreateUser() is returning success after inserting the user details into the database.
Login fails only If i try with password that I have given during creating the user.
I have tried both static password and GeneratePassword()
|
|
|
|
|
Joseph Craig DNN MVP Posts:11667

 |
| 07/30/2008 8:36 AM |
|
I suggest that you download John Mitchell's tool from here. Try using it to create a single user. See if that works. If it does, then the problem is in your script. If it fails, then we need to look at your DotNetNuke installation. This will, at the least, tell us where to look. |
|
Joe Craig, Patapsco Research Group Complete DNN Support |
|
|