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

HomeHomeDevelopment and...Development and...Getting StartedGetting StartedDNN Platform 8.0.4 - Custom Login and Registration PagesDNN Platform 8.0.4 - Custom Login and Registration Pages
Previous
 
Next
New Post
11/22/2016 10:20 AM
 

Hello,

We would like to create custom user registration page (with the ability to select a specific user role, acknowledge terms etc) and custom login page (with the ability to redirect user to specific pages based on their role, acknowledge terms)

We have attempted a first crack using DotNetNuke API. Are we going in the right direction? How to compile and deploy this code? Should this be a custom module? Can this be hosted as a separate application? Where/How to manage the DB connection string 

Can someone please advice/guide on how to proceed? Are there any documentation/samples/videos available?

-----------------------------------------------------------------------------------------------

using DotNetNuke.Entities.Users;

using DotNetNuke.Security.Membership;

 

using DotNetNuke.Security.Roles;

protected void btnSubmit_Click(object sender, EventArgs e)

        {

            UserInfo newUser = new UserInfo();

            newUser.Username = "testadd";

            newUser.PortalID = 0;

            newUser.DisplayName = "ADD DEMO";

            newUser.Email = "userdemo@add.com";

            newUser.FirstName = "ADD";

            newUser.LastName = "DEMO";

 

            UserCreateStatus rc = UserController.CreateUser(ref newUser);

            if (rc == UserCreateStatus.Success)

            {

                // Manual add role to user

                addRoleToUser(newUser, "DNNTest", DateTime.MaxValue);

            }

        }

        public bool addRoleToUser(UserInfo user, string roleName, DateTime expiry)

        {

            bool rc = false;

            var roleCtl = new RoleController();

            RoleInfo newRole = roleCtl.GetRoleByName(user.PortalID, roleName);

            if (newRole != null & user != null)

            {

                rc = user.IsInRole(roleName);

                roleCtl.AddUserRole(user.PortalID, user.UserID, newRole.RoleID, DateTime.MinValue, expiry);

                // Refresh user and check if role was added

                user = UserController.GetUserById(user.PortalID, user.UserID);

                rc = user.IsInRole(roleName);

            }

            return rc;

 

        }

 
New Post
11/22/2016 1:39 PM
 
You can create custom Login and Registration pages using the "standard" DNN tools. You needn't go to code to do this. You can also require a valid profile for registration and login that can force users to go through your process.

Custom registration can be handled via the User Accounts admin functionality.

--------------
As an aside, though, DNN Sharp's Action Form module makes this stuff a snap, and add all sorts of customization. And, as it's Thanksgiving here in the US, you might find a good Black Friday price. Coupled with My Tokens, there is even more.



Joe Craig
Patapsco Research Group, Ellicott City, MD
DotNetNuke Development and Services (http://patapscorg.com)
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedDNN Platform 8.0.4 - Custom Login and Registration PagesDNN Platform 8.0.4 - Custom Login and Registration Pages


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