Building Websites with DotNetNuke 5 — Save 50%
Quickly build and deploy your own feature-rich website with DotNetNuke 5, VB.NET, and C#
In this article by Michael Washington and Ian Lackey, we will discuss:
- Creating and modifying user accounts
- How user accounts tie into the security of your site
- What DotNetNuke pages are and how to create and administer them
- How to structure your site using pages
- The new Membership Provider Model
One of the most important aspects of running a DotNetNuke portal is trying to figure out how to administer the portal. From adding modules to working with users, it may take a while before you have mastered all the administration tasks associated with running a portal.
DotNetNuke uses a few terms that may be unfamiliar at first. For example, the term "portal" can be used interchangeably with the more common term "site". Similarly, the terms "tab" and "page" may be used interchangeably within the context of DotNetNuke. Knowing that they are interchangeable will help to understand the topics that we will discuss.
If you are used to working within a network environment, or have worked with different portals in the past, then you are probably comfortable with the term "users". For those of us who may not be very familiar with this term, can think of a website that you have registered with in the past. When the registration had been completed, a user account was provided to you. This account lets you return to the site and log in as a recognized user.
Everything that takes place on your portal revolves around users and user accounts. Whether users are required to register in order to use your services (such as a member site) or only a few user accounts are required to manage the content, functionality, and layout of your site, you will need to understand how to create and manage user accounts. Let's start with a general description of a user, and then you will see how to create and manage your users. In order to work through the examples, you will need to bring up your portal and sign in as an administrator account, such as the one created during the initial portal installation.
Who is a user?
The simplest definition of a user is an individual who consumes the services that your portal provides. However, a user can take on many different roles, from a visitor who is just browsing (unregistered user) or a person who registers to gain access to your services (registered user), to a specialized member of the site such as a content editor, to the facilitator (administrator or host) who is responsible for the content, functionality, and design of your portal. The difference between an administrator account and a host (or super user) account will be explained later in detail. For now, we will focus on the administrator account that is associated with a single portal. Everything in DotNetNuke revolves around the user, so before we can do anything else, we need to learn a little about user accounts.
Creating user accounts
Creating user accounts Before you create user accounts, you should decide and configure how users will be able to register on the site. You can choose from the following four different types of registrations:
- Public (default)
To set the registration type for your portal, go to the Site Settings link found in the ADMIN menu, as shown in the following screenshot:
The User Registration section can be found under Advanced Settings | Security Settings, as shown in the next screenshot:
Many sections within DotNetNuke may be collapsed or hidden by default. To view these sections, you will need to expand them by clicking the '+' in front of them.
The type of registration you use depends on how you will be using your portal. The following table gives a brief explanation of the different User Registration types:
Setting the user registration as None will remove the Register link from your portal. In this mode, users can only be added by the administrator or host users. Thanks to the new features in DotNetNuke 5, users who have been given the proper permissions can also manage user accounts. This allows the administrator or host users to delegate account management to other individuals with the proper access. If you plan to have all sections of your site available to everyone (including unregistered users), then selecting None as your registration option is a good choice.
If you select Private, then the Register link will reappear. After users fi ll out the registration form, they will be informed that their request for registration will be reviewed by the administrator. The administrator will decide whom to give access to the site. Unless an administrator approves (authorizes in DNN terms) a user, they will not be able to log in.
Public is the default registration for a DotNetNuke portal. When this is selected, the users will be able to register for yoursite by entering the required information. Once the registration form is fi lled out, they will be given access to the site and can log in without requiring any action on the part of an administrator.
If you select Verified as your registration option, then the
users will be sent an e-mail with a verifi cation code, once they fi ll out the required information. This ensures that the e-mail address they enter in the registration process is valid. The fi rst time they sign in, they will be prompted for the verifi cation code. Alternatively, they can click on the Verification link in the e-mail sent to them. After they have been verifi ed, they will need to type in only their login name and password to gain access to the site. Please note that proper SMTP confi guration is required to ensure delivery of the verifi cation e-mails.
Setting required registration fields
The administrator has the ability to decide what information the user will be required to enter when registering. If you are logged in as an administrator, then you can accomplish this through a combination of User Settings and Profile Properties.
A user who is given the appropriate permissions can also modify these settings; however, this requires a few additional configuration steps that we will not cover in this section.
To manage the Profile Properties for your site, select the ADMIN | User Accounts link. The User Accounts section appears as shown in the following screenshot:
In the preceding screen, select Manage Profile Properties, either by selecting the link at the bottom of the module container or by selecting the link in the Action menu—the menu that pops up when you point on the drop-down button adjacent to the module title, User Accounts (more information on Action menu is provided later). When you select this link, you will be redirected to a screen (see the next screenshot) that displays a list of the currently configured Profile Properties.
You can manage some attributes of the Profile Properties from within this screen. For instance, you can delete a property by clicking on the 'X' icon in the second column. Alternatively, you can change the display order of the properties by clicking on one of the Dn or Up icons in the third and fourth columns. If you change the order this way, make sure you click the Apply Changes button at the bottom of the page to save any changes. Your changes will be lost if you leave this screen without clicking the Apply Changes button.
If you want even more control, then you can edit a single property by clicking on the pencil icon in the first column.
You will see this icon extensively in the DNN user interface. It allows you to Edit/Modify the item it is associated with.
You can also add a new property by selecting the Add New Profile Property action from the Action menu. In either case, you will be redirected to another page, where you can enter information about the property. You will be redirected to the Add New Property Details page, as shown in the following screenshot:
Note that if you are editing an existing property, the Property Name field cannot be changed, so make sure you get it right the first time. If you need to change the Property Name, then you will need to delete and recreate the property. Most of these fields are self explanatory, but we will describe a few of these fields.
|Quickly build and deploy your own feature-rich website with DotNetNuke 5, VB.NET, and C#|
eBook Price: $26.99
Book Price: $44.99
The Visible checkbox controls whether the user can see the property. You can hide a property from the user by making sure that this checkbox is left unchecked—the important thing to remember is that the administrator can still see this property. This feature allows an administrative account to record private confidential information about a user.
The Required checkbox controls whether the user is required to enter information for this property. If it is set, the user will not be able to proceed without entering anything, although there are some settings that affect how this works in practice.
After completing this form, you will need to click the Next link to be taken to theManage Localization screen (shown in the next screenshot). It is recommended that this feature is used; however, if you plan to support only the default language, you are able to click the Return to Profile Properties List link instead to skip this screen.
These fields allow you to modify the text displayed to users based on the language settings of the portal. The information entered into these fields will be displayed to the user when managing their profile. It is recommended that values are provided for the default language at a minimum.
In addition to configuring the Profile Properties for the site, there are also some User Settings that control the registration process. On the User Accounts screen, you can access the User Settings by clicking on the link at the bottom of the pane, or the link in the Action menu. This will redirect you to the User Settings page that appears as shown in the following screenshot:
There are a lot of settings on this page. We will be focusing on this discussion in the settings that relate to registration, towards the bottom of the page. In our discussion of the Profile Properties, we indicated that you can set some properties to 'required', by checking the Required checkbox. In the normal registration, only the information required for validating the user's credentials is collected. The User Registration page appears as shown in the following screenshot:
If the Require a valid Profile for Registration radio button is marked as True, then the registration page also contains the list of Profile Properties and the registration will not be complete unless all the required properties have valid values.
Furthermore, if the Require a valid Profile for Login radio button is marked as True , then a user will be required to update his or her profile on login if it is no longer valid. This can happen if an administrator decides to make a profile property required after users have already registered, or if the administrator decides to add a new required property.
Managing your own profile
When you log in to the portal, you will see the Display Name entered during registration, located just below the search bar of the current page (if you are using the default skin). Click this link to bring you to the Manage Profile page that allows any registered and logged-in user to manage his/her own profile. The Manage Profile page appears as shown:
All users can access this screen in a similar way. There are four tabs (hyperlinks) at the top of this screen. A user can manage his/her own profile properties by clicking on the Manage Profile link. You will be directed to a page similar to the following screenshot:
Here, the red arrow icon indicates that a property is required, while the Visibility radio buttons indicate who can view this profile property. By default, this is set to Admin Only, but users can allow their profile information to be available to other users (Members Only) or all users, including unauthorized users (Public).
Registering a user manually
As we discussed earlier, you can set your portal registration to None. This will remove the Register link from your site. So, the only way to add users to your portal is to register them manually. An administrator can also add users manually even if the portal registration is set to Public or any other allowed value.
To do this, go to ADMIN | User Accounts on the main menu or you can click the Users link in the Common Tasks section of the control panel. This will bring you to the User Accounts screen. There are actually two ways to add a new user from this screen. You can select Add New User from the drop-down menu on the left-hand side of the module or click on the Add New User link at the bottom of the module, as shown in the following screenshot:
We will be setting up a user to help us administer the Coffee Connections site. We fill in the required information and click on the Add New User link.
If the Notify checkbox is selected, an e-mail will be sent to the specified e-mail address upon creation of the account. Also, note that if the Random Password checkbox is selected, DotNetNuke will generate a password for the account. When using the Random Password feature, make sure to select the Notify checkbox to ensure that the password will be sent to the user during account creation. This is very useful when creating user accounts manually. Otherwise, you must enter a password for each account you create. This, again, shows the importance of properly configuring the SMTP settings, which we discussed earlier.
When we are done, we will test the account we just created. To do this, we need to log off from our administrator account by clicking on the Logout link in the upper right-hand portion of the current page. Then click on the Login link. Enter the Username and Password of the user we just created. You will notice that while you are logged in as this user, you lose access to all the updating functionality that the administrator account possesses. Your screen will now appear as shown in the following screenshot:
The ability to update the portal is not available to our new user because he/she does not have the authority to make the changes. We certainly wouldn't want any user updating the content or the settings on the site. In other words, they do not belong to the right security role.
If you have read this article you may be interested to view :
- Understanding the DotNetNuke Core Architecture
- Understanding the DotNetNuke Core Architecture- An Extension
- Users, Roles, and Pages in DotNetNuke 5- An Extension
|Quickly build and deploy your own feature-rich website with DotNetNuke 5, VB.NET, and C#|
eBook Price: $26.99
Book Price: $44.99
About the Author :
Ian Lackey worked as a systems engineer for a St. Louis-based ISP from 1999 to 2002. At that time, he began developing web applications using ASP and migrated to ASP.NET shortly before the 2.0 release. Ian now works as a full-time programmer analyst II for Washington University in St. Louis Medical School - Department of Pediatrics. He also runs a small business, DigitalSnap Inc. that provides complete DotNetNuke solutions as well as individual modules (http://www.itlackey.net).
Currently Ian is involved in community-driven areas such as the OpenLight Group, which manages open source projects including several DotNetNuke modules and many Silverlight-based applications. He will also be speaking at the St. Louis .NET user group meetings this year.
Ian currently lives in a small town in Illinois, just East of St. Louis, with his wife Julie and two daughters, Britney and Brooklynn.
Michael Washington is a Website developer and an ASP.NET, C#, and Visual Basic programmer. He is a DotNetNuke Core member and has been involved with DotNetNuke for over 3 years. He is the author of numerous DotNetNuke modules and tutorials. He is one of the founding members of the Southern California DotNetNuke Users group. He has a son, Zachary and resides in Los Angeles with his wife Valerie.