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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.04.9.1 Adding "core" fields to user table4.9.1 Adding "core" fields to user table
Previous
 
Next
New Post
2/2/2009 10:59 AM
 

Ronald wrote

hmmm, so i could use a few queries to get what i need... however im sadly not that experienced in SQL (or ASP.NET for that matter)

however it would take a few different queries,

1 to validate the ID from another db (remote)
1 to grab the propertyfield name
1 at login to validate the stored ID against another db again

can anyone steer me a bit to where i must be looking and what to do?

im not sure how DNN uses queries so i made my own connection as well and used the whole variable package to get the result i wanted

i apologise if my previous post sounded a bit bloaty

Hey no problem.  We're all learning at one stage or another.  Lets actually get to the root of what you are trying to accomplish because maybe this can be achieved in a completely different way.  It sounds more like you are trying to authenticate the user against an external database + DNN database credentials so what we might be looking at is a customized Authentication Provider.  It'd be great to hear what your end-result needs to be and then perhaps we can offer up some suggestions/solutions that work well with your experience and leverages 3rd Party modules (if necessary).


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
New Post
2/3/2009 3:03 AM
 

well, i'd rather like to develop the module myself because its in the learning trajectory im in. however what i am trying to achieve is this:

User A registers on the site and enters his ID
the website validates the ID with the help of an external database
ID gets accepted and written into the users profile (however, only admins should be able to change the ID)
 

User A logs in
ID that is linked to the user gets pulled from the DNN database
The website validates the ID again (to check wether it hasnt expired, this is also entered in the external db)
ID gets accepted and the user can reach the "inner" website

when the ID's get rejected however they must state accordingly "Invalid" or "Expired"

i hope that is enough information, i already have a ValidateID process which checks the database for the ID's. this uses a sqlExecuteScalar to retreive two values
string found (this done to make it more global, e.g. Label1.text = ValidateID(strID) so it states the errormessage if any)
boolean valid

 
New Post
2/4/2009 9:30 AM
 

Ronald wrote

well, i'd rather like to develop the module myself because its in the learning trajectory im in. however what i am trying to achieve is this:

User A registers on the site and enters his ID
the website validates the ID with the help of an external database
ID gets accepted and written into the users profile (however, only admins should be able to change the ID)
 

User A logs in
ID that is linked to the user gets pulled from the DNN database
The website validates the ID again (to check wether it hasnt expired, this is also entered in the external db)
ID gets accepted and the user can reach the "inner" website

when the ID's get rejected however they must state accordingly "Invalid" or "Expired"

i hope that is enough information, i already have a ValidateID process which checks the database for the ID's. this uses a sqlExecuteScalar to retreive two values
string found (this done to make it more global, e.g. Label1.text = ValidateID(strID) so it states the errormessage if any)
boolean valid

Okay... I see this being possible in one of two ways:

  1. Custom Authentication Provider
  2. Custom Login and/or Registration module

Lets talk about the two methods and how they might be accomplished.  Using a custom authentication provider is probably overkill because for the most part you still want to use everything in the DNN authentication provider with exception that you want to add a step.  You'd still need a way to provide for entering in that ID upon registration and then your authentication provider could use that value behind the scenes and do whatever it needs to do.

Alternatively you could go with a custom login/registration module.  I like this approach because you can hand-tailor your registration module to be formatted the way you want, ask for the fields you want, etc.  You could still use *all* the DNN code behind the scenes to accomplish the registration and that is good.  What I'd do is have it fire off the code to check the ID upon registration and validate it... if it is good, allow the registration to complete and save their ID as a custom profile field.  In a nutshell, here is some code (copied straight out of my own production code) that saves a new user and stores something in their profile.

DotNetNuke.Security.Membership.UserCreateStatus crStat;

// add user first
DotNetNuke.Entities.Users.UserInfo info = new DotNetNuke.Entities.Users.UserInfo();
info.Profile.InitialiseProfile(this.PortalId);
info.DisplayName = textDisplayName.Text;
info.Email = textEmail.Text;
info.FirstName = textFirstName.Text;
info.LastName = textLastName.Text;
info.PortalID = this.PortalId;
info.Username = textUserName.Text;

info.Membership.Password = textPassword.Text;
info.Membership.Username = textUserName.Text;
info.Membership.Email = textEmail.Text;
info.Membership.Approved = false;

info.Profile.PreferredLocale = "en-US";
info.Profile.FirstName = textFirstName.Text;
info.Profile.LastName = textLastName.Text;
info.Profile.SetProfileProperty("Employee_ID", textEmployeeId.Text);

crStat = DotNetNuke.Entities.Users.UserController.CreateUser(ref info);

So now lets assume you have that.  If you have your own login module you can validate the login with the ID (load the user and then use the info.Profile.GetPropertyValue("someproperty") to retrieve it).  You can use DotNetNuke.Entities.Users.UserController.ValidateUser to ensure credentials are correct and, if so, then use DotNetNuke.Entities.Users.UserController.UserLogin to log them in (and then you should redirect them to a new page or the same page so the cookies get loaded in and used).

Hope that gives you a starting point.  Any more questions, ask away.

DotNetNuke.Entities.Users.UserInfo info =


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
New Post
2/5/2009 3:33 AM
 

i guess i will have to re-read that later today when my brain cleared up.

however 2 questions

1) to enter the data would the cmdRegister button be enough?
since i already have the database check wedged somewhere in the admin/user.user.ascx.vb file. then i would call that and set up the pre-register event like this:

if (ValidateID(ID)) then

     'code to execute registration

else

     label1.Text = "Error"

end if

however, ValidateID gives back a string with error message when the ID is invalid
2) so is it possible to typecast string to bool?

im currently trying to wrap my head around how to make the custom registration module and implementing it into the site

 
New Post
2/5/2009 9:38 AM
 

You can cast string to bool but it needs to be a compatible cast (ie the string says True or true, False or false).  Does the ValidateID return an empty string if the ID is valid?  If that's the case you could merely check that ValidateID = String.Empty although I'd be more inclined to see the ValidateID return bool and have an output parameter that contains an error message when/if there is an error.  You can use Boolean.TryParse to do a graceful cast to bool from string or you can use Convert.ToBoolean for a more direct cast.

I have some complete code that I'm using for a simple registration module if you'd like.  Contact me directly and I can zip it up (it is part of a larger module so i'll just zip up that control and code).

*EDIT* Sorry, forgot to answer your question about whether you can just use the code and modify inside of the User.ascx.vb.  The short answer is yes, you can modify that code if you want.  The problem with that is whenever an update to DNN comes out and you want to upgrade you'll have to reinject your changes into that file.  That just gets nasty.  It is much easier IMHO to create a module that extends the functionality you're after instead of trying to change the core.


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.04.9.1 Adding "core" fields to user table4.9.1 Adding "core" fields to user table


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