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

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Write registration data to additional databaseWrite registration data to additional database
Previous
 
Next
New Post
11/20/2006 8:54 PM
 

Well, through some sweat and blood, I finally figured it out!!!  My first caviet...I am NOT a SQL guy, so anything that could be done better can be certainly be changed.
Now, a couple of notes:

Windows 2003 Server, DNN 4.3.5, SQLExpress

I didn't really want to change the core code, so I added a call from the adduser sp to a new one.  That way it is just one line of code to the core sp.  Next, I created an sp to take the entered text for the username and password and push it to the external database, an email application called hMail in my case.  But there was more...to integrate the deletion of accounts and changing of passwords, I knew that the userid's must match.  So in my new sp, I did a lookup for the account that was just created and used the userid to make them the same.  Finally, my email app uses MD5 encryption for the password, so I had to find a extended stored procedure for MD5 creation and add that to get the hash (http://www.codeproject.com/database/xp_md5.asp).  With that said, here is my code (I only have the add user done right now, I will work on the deletion and change password this week):

1. Added the "MD5 Hash SQL Server Extended Stored Procedure" from this site:
http://www.codeproject.com/database/xp_md5.asp

2.  Added this line to the very bottom of DotNetNuke.dbo.AddUser stored procedure:
-- This Executes a stored procedure called AddUser_Email and
-- passes the values for @Username and @UpdatePassword to it.
EXEC DotNetNuke.dbo.AddUser_Email @Username, @UpdatePassword

3. Create a new stored procedure called AddUser_Email with the following code:
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[AddUser_Email]

-- brings in variables from the registration page and AddUser Stored Procedure
 @Username  varchar(255),
 @UpdatePassword varchar(255)
AS

-- Declaring variables, passing UserID for other admin functions.
-- Since I am using this for email, I need to append the domain name to the username.

DECLARE @UserID int 
DECLARE @Domain varchar(255)

-- This returnd the UserID for the newly created account.
SELECT @UserID = UserID
 FROM   Users
 WHERE  Username = @Username

-- Have to do this so we can write to the AccountID field which is the key.
SET IDENTITY_INSERT hMail.dbo.hm_accounts ON
-- Statically set variable to append to username to make complete email address.
SET @Domain =
'@HSGWorld.com'

-- Declaring another variable for the MD5 Function
DECLARE @accountpassword CHAR(32)
-- Send the text entered in the password field on the registration page to the encryption function
-- Hash is returned as variable

EXEC master.dbo.xp_md5 @UpdatePassword, -1, @accountpassword OUTPUT

-- Finally, write to the email Database the fields I needed. 
-- Note the @Username+@Domain to make the complete email address.
-- And the @UserID pulled from the DNN Database.

INSERT INTO hMail.dbo.hm_accounts (accountid, accountdomainid, accountadminlevel, accountaddress, accountpassword, accountactive, accountisad, accountmaxsize, accountvacationmessageon, accountpwencryption)
VALUES (@UserID, 1, 0, @Username+@Domain, @accountpassword, 1, 0, 0, 0, 2)

-- This closes the key field.
SET IDENTITY_INSERT hMail.dbo.hm_accounts OFF


That's it.  Now...not sure what you need to do to your script, but the INSERT INTO and VALUES command should work for just about anything you need.
I'll post more when I finish it.

OH...in case you are wondering, I am using an aspx "app" called SmartWebMail.  It is the IMAP client side for the email system.  I installed it and threw it into an iframe to show it on a page.  Maybe one of the module guru's would take this and make it into a nice module HINT HINT!!
The hMail server is the backend, running on my server and using the SQL EXpress DB
And then the integration part from the directions above.

Hope that helps!!

 
New Post
11/20/2006 9:11 PM
 
Uhh ... bkingx ... for not being an SQL guy, you sure do seem pretty damn good at this stuff!

I'm pretty speechless ... this should come to the attention of some of the important people around here. Congrats!!

 
New Post
11/20/2006 9:47 PM
 

Thanks dude!  I can follow code pretty good and emulate, but not develop from scratch.

BTW...the delete code was even easier!!

Added the following code to dbo.DeleteUser

delete
from
hMail.dbo.hm_accounts
where accountid = @UserID

WOOHOO!!  Now I need to figure out the update password functions and it will be GOLDEN!!

 
New Post
11/22/2006 5:54 PM
 
Thats a very useful mod, I am adding that to my archive!

Another alternative is our Dynamic Registration module. This module allows you to create any number of events after the initial registration or updated registration. The module can be setup to only allow the event to fire upon a condition (i.e. the users response) but it doesn't sound like you would need that feature for this mod. Either way, one of the event types is a SQL event type that would allow you to use the form fields and execute either a SQL update or insert statement with those field values. This would potentially allow you to execute the statement within the module so that you would not need retrofits when you upgrade DNN.

The other module Travis mentioned our group is working on is for exporting/importing users into DotNetNuke. We hope to have a solution delivered for this by the end of the month. The full details of the module and documentation can be found from the links below. After next weeks final testing on www.betasprings.com we hope to release the module by Dec 4th.


Here are the links for more info:

DotNetNuke Registration Module

DotNetNuke User Import Module


-Chad
 
New Post
11/23/2006 10:37 AM
 
Hi All.....Well, I hit a brick wall. It turns out that the variable @UpdatePassword above is in bit form and not the actual password entered into the registration form. That appears to happen somewhere else. Well, I have a few options to try and make this work...figure out the decryption process and use that to get the password, or find EXACTLY where the text is passed into the process and snag it from there.

I'll keep you all updated to what I figure out.
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Write registration data to additional databaseWrite registration data to additional database


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