Creat a custom Login & Registration Module.
Last Post 02/26/2010 7:48 AM by Joseph Craig. 36 Replies.
Author Messages
bobbyjosephg
Nuke Pro
Nuke Pro
Posts:82


--
07/26/2007 10:00 AM  
Hi,
   I am new to DNN.I want to create a custom login and Registration module.I dont know from where to start.I have created two sample modules and they are working fine.Is there any tutorial or some other form fo help to create a custom login module.

Thanks
Bobby
Joseph Craig
DNN MVP
Posts:11667


--
07/26/2007 11:16 AM  
I'd suggest that you start by seeing if you can simply style the existing login module. If not, you could create a "new" module by modifying the existing one. I think that you want to start with /admin/security/signin.ascx.

But ... I'd really recommend that, as a newcomer, you try to accomplish what you need with skins, styling, etc. rather than by writing custom modules.

What do you need/want that's not provided by the existing functionality?

Joe Craig, Patapsco Research Group
Complete DNN Support
bobbyjosephg
Nuke Pro
Nuke Pro
Posts:82


--
07/27/2007 12:20 AM  
Hi ,
Thanks for the reply.Why I want a custom module is beause the default module has a register button, I want a link in it's place .I could not figure out a way to change this.Also for the default registration page I need more details to be saved.I think now you have understood my requirement.

Thanks,
Bobby
Joseph Craig
DNN MVP
Posts:11667


--
07/27/2007 8:46 AM  
Thanks for clarifying this.


There are three buttons:  Login, Register and Forgot Password.  Are you aware that you can style buttons to make the button part go away, underline the text and "almost" make a button look like a hyperlink?  I did some quick playing around and was able to get everything but the hover behavior.  Perhaps there are ways to do this.

If you really do want to change buttons to hyperlinks (there actually are 3 buttons in the signin module), I would think that you could change the buttons in /admin/security/signin.ascx to HTML hyperlinks.  If you make that change and make corresponding changes to the signin.aspx.vb file, that might be all that you need.

As for needing to save more details for registration, click on "Users" and then on "Manage Profile Properties" at the bottom of the User Accounts screen.  You'll find that you have considerable control over what information is collected at registration time, including what is mandatory and what is not.  And, you can add your own fields.  Be sure to take a look at How to Manage Profile Properties in User accounts (Creating a custom registration page) for a detailed look at this feature.

I hope that this helps.

Joe Craig, Patapsco Research Group
Complete DNN Support
bobbyjosephg
Nuke Pro
Nuke Pro
Posts:82


--
07/27/2007 11:56 AM  
Hi ,
Thanks for the reply I tried it and it worked.Is it possible to ad other modules to the registration page.Like I have the task of building a shopping cart.There are liks to featured Items common items , Login etc that should be displayed on the left and right.

Regards,
Bobby
Joseph Craig
DNN MVP
Posts:11667


--
07/27/2007 4:05 PM  
The short answer is yes. The login module is just a module. You can put other modules on the page.

If you'll take a look at stockcentral.com you'll see another approach. There, we put the login module on every page, but it disappears when you login. The "normal" placement of username and login/register/logout link in the upper right has some conditional code so that it is invisible until you log in. That way, there's always a way to login or to logout.

Joe Craig, Patapsco Research Group
Complete DNN Support
Kim Seav
Nuke Newbie
Nuke Newbie
Posts:6


--
07/31/2007 12:01 AM  
Hi,

I'm having a similar problem with customising modules. At present our setup is one DNN install and multiple portals hosting a number of unique websites. I've found that it is difficult to customise certain features to suit with each portal. Say I want to change the LOGIN module in the ADMIN/SKINS (AppResources, ascx files) folder, if I do this say change "username" to "org name" or change the positioning of the boxes or text, this change will reflect on all portals as this is the core file. I don't want this to happen as this will not suit with all client's sites.

Is there anyway to customize and style a module according to each portal's needs without it affecting everything within our other sites?

Thanks, Kim
bobbyjosephg
Nuke Pro
Nuke Pro
Posts:82


--
07/31/2007 5:47 AM  
Hi Kim,
you can try creating a new module for the login and then include it in the portals you need.To create a new module open DNN source from visual studio and then create a new webuser control and then copy the code from teh sigin.ascx.This should work .Please test this before deploying it.I have created this in this way.Can send it if you want.
Thanks
Bobby
Joseph Craig
DNN MVP
Posts:11667


--
07/31/2007 6:51 AM  
I think that the first commandment of DotNetNuke installations should be:  THOU SHALT NOT edit code!  (There are times that you'll break this commandment, of course, but you should really take it seriously.)

Most of the "canned" text that appears on the screen of a DotNetNuke installation is "localized" text, which means that it's not included in the source code, but is included in special text modules that provide the text in various languages.  If, for example, your site's language is German, much (most? all?) of the text should appear in German.  Many modules also contain localized text.

The localized text is accessible via the Languages menu item that's available on both the host and the administrator tabs.  I haven't ever considered this before, but I assume that the two tabs are different and that the host can customize text for the portal and that the administrator can customize for the site.  But I haven't checked this out.

In any event, if you click the Languages tab and then use the Language Editor (it's in a dropdown list next to the Languages module name) you can access and modify the standard text.  Once you are in the Language Editor you can also access and modify the localized text that is applied to any modules that have localized text.  If you look on the left you'll see a directory tree that includes Local Resources and Global Resources.

Expand the Local Resources area.  If you are interested in changing the text for Signin.ascx, look under Local Resources\Admin\Security\App_LocalResources\signin.ascx.

It will probably help to dig through the code to see which items you want to change, but change them here, and refrain from editing text in the modules.



Joe Craig, Patapsco Research Group
Complete DNN Support
bobbyjosephg
Nuke Pro
Nuke Pro
Posts:82


--
08/06/2007 12:41 AM  
Hi Joe,
Thanks for the advice.I shall not edit the DNN module.I want a custome login module where the email-id should be the user id .Is there any way to configure this or should I create a new module for this.
Rui Silva
Nuke Newbie
Nuke Newbie
Posts:2


--
08/06/2007 6:08 AM  
Hi all,
I'm a portuguese developer and a "frequent" reader (subscribed) of this site.

I have a similar need for custom login module, with the exception that I must validate users against different schemas.

In my scenario, I have to validate users against the normal aspnet_membership tables, but if found there, I must go to another table (oracle) and check for some flags to finaly choose if a certain user has the ability to login or not, and if not, redirect to a custom registration screen.

I suppose creating a new module based on ~/admin/signin.ascx is the way to go and insert there the new access and validation code.

Has anyone already made this kind of approach that could mail (or just answer here) the basics for this ?

I'm having lots of errors and would like to try to shortcut this as much as possible.

My current scenario is:
DNN version 4.5.0
Visual studio 2005
sql server 2005 (DNN)
Oracle 10i (custom app)
Web Application project with references to dotnetnuke.dll, dotnetnuke.provider.membership.sqldataprovider, dotnetnuke.sqldataprovider, dotnetnuke.webcontrols, dotnetnuke.webutil and sharpzlib.dll (this is for my custom login module)

any help or orientation greatly appreciated
Rui Silva
Joseph Craig
DNN MVP
Posts:11667


--
08/06/2007 8:26 PM  
If you want to authenticate users against an external user database, you don't want to modify the login module. Instead you want to create a custom Membership Provider. You'll probably also want to create custom Profile and Role providers, too.

I believe that there are commercially available providers that will allow you to run DNN with Oracle, too. But, that's a different issue than authenticating against a second database of users.

Joe Craig, Patapsco Research Group
Complete DNN Support
bobbyjosephg
Nuke Pro
Nuke Pro
Posts:82


--
08/07/2007 1:43 AM  
Hi Joe,
Thanks for the reply, but how do you create a custom Membership provider.

Thanks & Regards
Bobby
Lee Sykes
DNN Creative Staff
Nuke Master VI
Nuke Master VI
Posts:4945


--
08/07/2007 5:10 AM  
This post may be of help
Lee Sykes
Site Administrator
Subscribe to the website : DotNetNuke Video Tutorials : The Skinning Toolkit : DotNetNuke Podcasts

Twitter: www.twitter.com/DNNCreative

Lee Sykes's Facebook Profile
Kim Seav
Nuke Newbie
Nuke Newbie
Posts:6


--
08/09/2007 9:09 PM  

Hi Bobby

Thanks for your response. I'm thinking that it sounds like what you've had to do to create a new module is something our programmer does, I was really wanting to know if there was something I could do myself as a front-end developer. Wouldn't mind haveing a look at your file though. Would you mind sending it?

Thanks!!

Joseph Craig
DNN MVP
Posts:11667


--
08/10/2007 6:36 AM  
Kim,

>Is there anyway to customize and style a module according to each portal's needs
>without it affecting everything within our other sites?

Yes, there is, and that's exactly the point to using DotNetNuke. Of course, if you start modifying code, you'll break that. This is one of the reasons we recommend against modifying the DotNetNuke code.

You can customize all (most?) of the text in DotNetNuke by modifying the localized text using the Language Editor. A site host can do this and the changes propagate to every portal. But, I think that modifying at the portal level keeps the changes local to the portal.

If you want to use skins, a portal administrator can install skins that apply only to his portal. Those skins can customize a portal independent of all of the other portals on the site.

Joe Craig, Patapsco Research Group
Complete DNN Support
Apdev
Nuke Newbie
Nuke Newbie
Posts:1


--
08/23/2007 3:30 AM  
Hi Guys,

In DNN, instead of accessing the database directly via membership provider, I would like the DNN gets the data via Web Services.

In addition to the basic login features, I would like to add more functionalities such as code genarator for each user and captcha number.  This architecture seems to be used mostly in a commercial setting for security reasons.

My questions:
1. Is it possible to do this in DNN without breaking the flexibility aspect of the provider pattern?If so how?
2. Which one is more visible, creating a new login module and remove the default one or just modifying the basic login module with the new requirements?


Thanks.


Agung
Joseph Craig
DNN MVP
Posts:11667


--
08/23/2007 7:46 PM  
It would be better to replace the "stock" Membership Provider with a custom version. You may also want to look at the Role and Profile providers, too.

The existing providers will show you how they were set up, and also the functionality that you have to provide.

If you do this, you can guarantee that the higher-level DotNetNuke functionality is not damaged ...

Joe Craig, Patapsco Research Group
Complete DNN Support
julien
Nuke Newbie
Nuke Newbie
Posts:2


--
09/06/2007 4:13 PM  
Hi everyone, im kind of new with dnn and my problem with the registration module is this.
Im developping a multi-language site.
I'm aware of the possibilities with the localized text to set different text for a selected langage, but I need to go further... I need to populated a list (i.e: status: married, single, divorced..) but i need 2 groups of item (one for each language).
How is it possible to add custom control to that module, because when im going in "Manage Profile Properties"-->"Add New Profile Property", the data type are limited.  SO even if im solving my list problem, I will encounter some new difficulties if I need to customize the registration module further.
Can anyone give me a clue, or simply a global way to approach this
Thanks
Joseph Craig
DNN MVP
Posts:11667


--
09/06/2007 7:50 PM  
You can create list types of data in the profile. And, when you create a new item, you can add localized text for the item. I believe that you can create localized text for every language that you have installed.

Joe Craig, Patapsco Research Group
Complete DNN Support
julien
Nuke Newbie
Nuke Newbie
Posts:2


--
09/06/2007 10:07 PM  
I can create a data type LIST but when I add new item, i dont see where I can set the localization.  When I add a new entry, I only see "entry text", "entry value" and "enable sort order" AND save or cancel. I dont see where the localization for the SPECIFIED ITEM in the list is..
thanks
bobbyjosephg
Nuke Pro
Nuke Pro
Posts:82


--
09/07/2007 4:12 AM  
Hi,
I am trying to change the aspnetmembership.What I actually need is to use the email ID as the username.In the registration page also there is no need of a separate username.I have not got any idea of how to do this.Please help
Regards,
Bobby
Joseph Craig
DNN MVP
Posts:11667


--
09/07/2007 6:59 PM  
I think that you are right that the actual text in the List is not localizable.

Joe Craig, Patapsco Research Group
Complete DNN Support
Paluri Vimala
Nuke Newbie
Nuke Newbie
Posts:9


--
12/04/2009 6:58 AM  
Hi Friends, I am newbie to DNN. Can anybody help me in Customizing layout of my custom login module. My Login page has 2 login modules one for usertype1 and another for usertype2. Have created new modules for them by placing login.ascx code there. Now I need to customize default layout of login modules. And it should not affect to the default login. Since we donot have username and password in Login.ascx which copied from Admin/authentication/login.ascx. By googling I have done changes with login.ascx file reside in authenticationservices/dnn under desktop modules. So now I am getting changes to both of the modules. I have requirement that both logins has unique styling and they shouldnot be same. Please suggest me on how uniquly customize eachof my custom login modules in dotnetnuke. Thank you.
Joseph Craig
DNN MVP
Posts:11667


--
12/04/2009 8:26 AM  
You might want to wrap each separate Login module in its own named div tag.  You can do this by placing the opening tag in the Header section of the module's settings, and the closing tag in the Footer section.

Then, in your CSS file, you can use subclasses to separately style the two modules.

Joe Craig, Patapsco Research Group
Complete DNN Support
Paluri Vimala
Nuke Newbie
Nuke Newbie
Posts:9


--
12/05/2009 1:46 AM  
Thank you Joseph. Its nice idea. Will work on it. Thank you.
Joseph Craig
DNN MVP
Posts:11667


--
12/05/2009 6:54 PM  
Please let us know how that works for you.

Joe Craig, Patapsco Research Group
Complete DNN Support
Paluri Vimala
Nuke Newbie
Nuke Newbie
Posts:9


--
12/18/2009 10:22 PM  
Hi Joseph, Sorry for the late reply. It works fine for me. By taking id of each div module container and by overriding default classes able to get unique styling for each login module. Thank you.
Paluri Vimala
Nuke Newbie
Nuke Newbie
Posts:9


--
12/29/2009 12:40 AM  
Hi friends, Can anybody please suggest me on the following issue: I have setted custom login page as my home page. While I am navigating to my nuke site root url as a general user with out logout click, it should redirect to welcome page instead of login page. Please suggest
Paluri Vimala
Nuke Newbie
Nuke Newbie
Posts:9


--
12/29/2009 1:08 AM  
Can anybody help me on how to write page events for a custom pages created in nuke site. I need to write page load event for my custom login page. Please suggest.
Joseph Craig
DNN MVP
Posts:11667


--
12/29/2009 7:09 AM  
That's a bit of an open ended question.

I would recommend that you look at the book "Professional DotNetNuke Module Programming" by Mitchel Sellers.  There is other good information available at Michael Washington's website, adefwebserver.com.

Joe Craig, Patapsco Research Group
Complete DNN Support
Paluri Vimala
Nuke Newbie
Nuke Newbie
Posts:9


--
01/04/2010 3:23 AM  
Hi friend, I missed out small logic to think. Now I cleared the redirect issue. Its really a nice book for newbies. Thank you.
HPi
Nuke Newbie
Nuke Newbie
Posts:2


--
01/11/2010 7:58 AM  
Posted By Joseph Craig on 23 Aug 2007 7:46 PM
It would be better to replace the "stock" Membership Provider with a custom version. You may also want to look at the Role and Profile providers, too.

The existing providers will show you how they were set up, and also the functionality that you have to provide.

If you do this, you can guarantee that the higher-level DotNetNuke functionality is not damaged ...

Hi,

I have been developing modules, providers etc. for the last few year for DNN 4 and 5. But when I had to create custom role and membership
providers while using external databases and web services, I ran across a few very annoying "features" that seem to be very hard to bypass.

  • DNN is getting some information from database views, like vw_UserRoles and vw_TabPermissions, which means that if either DNN Users or
    Roles tables are empty, those view query based features and functions don't work.
  • DNN supports only integers as role and user ids, so using guids or other values in an external database is useless, unless you create
    mapping tables and link those ids together in the providers
  • DNN is sometimes querying for roles by (seemingly) hardcoded value(s), like "Administrator" even though the role provider doesn't
    offer a role with that name

Do you have any suggestions as to how to bypass these things, without creating e.g. users and roles to DNN's tables with similar values as
the ones in the external database? It's not a hard job, but it doesn't sound like it should be... checking every time when a user logs in or
someone is adding a new user based tab permission, if that user or that role already exists in DNN's table, and if not, creating them. I
would appreciate if there is some kind of useful solution, instead of these solutions I have found.
Joseph Craig
DNN MVP
Posts:11667


--
01/11/2010 8:16 AM  
No, I don't have any suggestions.  I suspect that you know a LOT more about than I know!  This would possibly be a good item for discussion on the forums intended for developers at DotNetNuke.com, though.

Joe Craig, Patapsco Research Group
Complete DNN Support
HPi
Nuke Newbie
Nuke Newbie
Posts:2


--
01/11/2010 4:28 PM  
Thank you for your quick answer. I'm not sure about that, how much I know about DNN. Where ever I go, I'm just finding more restrictions I'll ask this same thing from dotnetnuke.com, even I'm not sure how to make myself enough clear or even visible in that mass.
samual
Nuke Newbie
Nuke Newbie
Posts:2


--
02/25/2010 10:38 PM  
Hi,

I am new to dotnetnuke(version-5.2).

I want to create a custom registration module I have created one and I am using the default dotnetnuke tables to store the data but there are two fields in database(p word and p wordsalt )to store data regarding p word in some encrypted form how to change my own custom module p word field to store values in these fields.

The next problem I am facing is that after submitting the data what to do so that user get loginned to site.

I got an error message("Violation of UNIQUE KEY constraint 'IX_DNN_Users'. Cannot insert duplicate key in object 'dbo.dnn_users'. The statement has been terminated.") when I submit the data in custom registration to store in database How to resolve that.

Another error message("Invalid length for a Base-64 char array.") comes when I try to login via the account that I have created using custom registration

Please Help me.....



Thanx in advance
Joseph Craig
DNN MVP
Posts:11667


--
02/26/2010 7:48 AM  
Since you are new to DotNetNuke, I think that you should first learn a bit about the inner workings before diving in and coding.

DotNetNuke contains methods to create and modify users, and to login the in and log them out.  You should use those, and you should not be directly interacting with the database.

Look at the existing registration and authentication code and understand it.  Hopefully, you'll be able to take that as a base and modify it for your needs.  Whenever possible, create additional modules, etc. rather than replacing code.  If you work that way, you'll be able to upgrade and keep your custom functionality. 

The book "Professional DotNetNuke 4" has a large section that discusses member management.  Mitchel Sellers' book on creating DotNetNuke modules has lots of very useful information.  Michael Washington's ADEFWebServer.com site has lots of information.

All that said ... my recommend would be that you get a copy of Data Springs' Dynamic Registration and Dynamic Login and use those to create your customized registration and login procedures.  You won't be able to duplicate what they have done for the cost of the modules.

Joe Craig, Patapsco Research Group
Complete DNN Support


---