You need to Register for free and Login to post a message in the forum.

Forum

Subject: Validation Failed
Prev Next
You are not authorized to post a reply.

Author Messages
UmaRam
Nuke Active Member
Nuke Active Member
Posts:27

29 Jul 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

jncraig
DNN Creative Staff
Nuke Master II
Nuke Master II
Posts:2371


29 Jul 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
DNN Creative Support
Subscribe to the website
UmaRam
Nuke Active Member
Nuke Active Member
Posts:27

29 Jul 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.
jncraig
DNN Creative Staff
Nuke Master II
Nuke Master II
Posts:2371


29 Jul 2008 8:20 AM  
Have you tried using the "Forgot Password" link and using the password that is sent to you?

Joe Craig
DNN Creative Support
Subscribe to the website
UmaRam
Nuke Active Member
Nuke Active Member
Posts:27

29 Jul 2008 8:39 AM  
Yes. I tried forgot password also. Still login fails.
jncraig
DNN Creative Staff
Nuke Master II
Nuke Master II
Posts:2371


29 Jul 2008 8:43 AM  
Are you able to login with the Host and Admin accounts?

Joe Craig
DNN Creative Support
Subscribe to the website
UmaRam
Nuke Active Member
Nuke Active Member
Posts:27

29 Jul 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.
jncraig
DNN Creative Staff
Nuke Master II
Nuke Master II
Posts:2371


29 Jul 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
DNN Creative Support
Subscribe to the website
UmaRam
Nuke Active Member
Nuke Active Member
Posts:27

30 Jul 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

jncraig
DNN Creative Staff
Nuke Master II
Nuke Master II
Posts:2371


30 Jul 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
DNN Creative Support
Subscribe to the website
UmaRam
Nuke Active Member
Nuke Active Member
Posts:27

30 Jul 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()

jncraig
DNN Creative Staff
Nuke Master II
Nuke Master II
Posts:2371


30 Jul 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
DNN Creative Support
Subscribe to the website
You are not authorized to post a reply.



ActiveForums 3.7

Latest Forum Posts

Restricting DateEditControl till date by coder247
Hi All,   We are using the DateEditControl (for obvious reasons!!) in our application. But we want t...
RE: Email Set UP per Portal by jncraig
I think that the answer depends on how email is configured at your host. You'll probably have to co...
RE: skin/container error load by jncraig
I would suggest checking permissions for directories. Does this occur only when you upload a skin...
RE: Add New Profile Properties by jncraig
Hmmm ... I don't have an answer. Does anyone else?
RE: No Access for me too by ristori
it is ok now. Thanks for this action.
skin/container error load by islandman
Has anyone else run across this error when loading skins or containers from site settings?I am using...
Email Set UP per Portal by islandman
How do I set up a unique email address per domain name off 1 hosting environment. for example...m...
RE: localhost Install issues by cdees
Lee: I wanted to follow up on this for anyone following this thread. I have been unable to solve t...
RE: Add New Profile Properties by WSI
HI Joe, The DNN version is 4.5.5. Thanks, Cliff
Change Skin on URL by vinita
Hi,Can the skin be changed based on the url used to access a portal. Multiple portal aliases may be ...
problem creating child portal by kabamaro
  Hello all i have 4 Aliases for my parent portal , lets call them X,y,Z,WIn all Aliases i can creat...
problem creating child portal by kabamaro
  Hello all i have 4 Aliases for my parent portal , lets call them X,y,Z,WIn all Aliases i can creat...
Best DNN portal ever! by derpir
I have been a subscriber since august 2008, and DNNCreative.com is simply the best DNN Portal, their...
RE: skinning trouble by derpir
Hello Yes could you be so kind and take a look att the htm-file and css-file.I would be very gratef...
Search function is not working by kishorpawar
I am using Seach module in my project but not working, i have set   host setting alsoHost --> Schedu...
RE: backend is changing from sql2005 to sql2008 by leesykes
hello,There should not be any code changes needed, but you'll need to make sure that SQL 2008 upgrad...
RE: skinning trouble by leesykes
Hello,I would need to see your code to help you with this one, you can zip up your files and attach ...
RE: Installing DotNetNuke 4.9.00 on VWD 2005 w/ SQL server 2008 by leesykes
I have run a test with SQL Server 2008 express and DotNetNuke installed in exactly the the same way ...
RE: Issue 39 Interview by leesykes
thanks Bill, glad it was useful, we will have a think about the best way to approach this,Thanks,
RE: Issue 39 Authentication by leesykes
yes I have a live site in 4.9.0 at it seems stable as well.
AppTheory
RSS Feeds