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:2357


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:2357


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:2357


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:2357


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:2357


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:2357


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

Yahoo Answers by cdtguru
Hey, i was wondering if anyone knew of a module that would create a similar system to Yahoo Answers...
(catalook) Itempane changes on product pages ?? by Gaz35
Hi , hi , I don’t know if you can help me , here is the site in question http...
RE: Virtual Pc 2007 help by jeff@zina.com
You need to get the Virtual PC's network set up.  Might check the Virtual PC news group: http://www...
DNNCreative Just Keeps Getting Better by jeff@zina.com
Kudos on issue 39, the article on importing large quantities of data was both timely for me and spot...
RE: Videos by clippy
Hello from France My question is about the videos for beginners, and specially n° 3; I'm working...
skinning trouble by derpir
HelloI have uploaded a skin to my DNN-website, but I want to make som changes. I have made some chan...
RE: Column width in UDT by VickySwift
In case anyone else is looking for the answer to this, I have been able to add the headers back in b...
RE: search not working by jncraig
Did you either reindex the site to turn on the scheduled task to do it?
RE: Template Issue by jncraig
No, you need to install your custom modules before you use the template.
RE: error message in registration page by jncraig
I'm not sure that you can avoid them, short of rewriting the module.You might want to investigate Dy...
Template Issue by Bobbyjosephg
Hi,   Today I have come up with a problem with templates.I was successful in exporting a template an...
RE: search not working by sanju_k1421
I checked     host==>admin search  page   that is set both limits min //max  page     still i m n...
RE: error message in registration page by coder247
but how do I avoid the error messages provided by default in dnn?
RE: Style sheet does nothing by andorz
Oh. I was told to do that in my thread at the dotnetnuke.com forum. http://www.dotnetnuke.com/Commun...
RE: Videos by clippy
Thank you to answer so quickly. It's really kind from you. I appreciate
RE: Simple subscribe newsletter module by jncraig
I seem to recall that DataSprings has an "Opt In" module. I haven't used it, though.
RE: Videos by jncraig
No, you can view them in any order.
RE: Skim Question by tlsadler
Wow! Went to Snowcovered and the 50% off Promo more then paid for itself. I actually wound up buying...
Videos by clippy
Hello from FranceJust a little questionIs there any order to respect to look the videos ("issues"). ...
RE: Skim Question by tlsadler
Thank you very much. I've followed many of your posts and will check it out. I had thought about get...
AppTheory
RSS Feeds