Sign In  |  Register
 
 DotNetNuke Powered!
DotNetNuke Support Forums

Hiding Profile Properties from the admin searchable fields

Rate this topic:

Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

AuthorMessages
herchenx
Posts:3



09/10/2007 10:23 AM  

I need to store usernames and passwords for another app so users can click a link and connect directly to the second app without logging in again.

I want to just store this information in the UserInfo.Profile.ProfileProperties collection, but I don't want admins (or anyone) to be able to select the password field as a search criteria in the User tool (you can drop down a list of fields to search by when logged in as admin or host within the user management tool of DNN)

I wonder if there is a different way to quickly store user info within DNN (I don't want to write my own tables, sp's and all the CRUD objects, I just want to piggy-back on DNN functionality) OR if there is a way to hide this option from search results.

Secondarily, is there an easy way to encrypt the passwords when storing them? I am considering making it a requirement that they just use the password from the other app as their password for our app so I can count on the DNN password encryption mechanism.

I wanted to start this post by saying that I have spent a fair amount of time looking through the forums on Snapsis and have been incredibly impressed. This beats the pants off the DotNetNuke forums (or any other DNN forums I have found) in terms of actual useful information and helpful posts and comments. I didn't put this comment first however because I wanted this post to actually be read. Thanks to Snapsis for creating this great community and I look forward to getting more involved.

.john.

John Mitchell
Posts:3084



09/11/2007 12:25 AM  

Hi John,

Thanks for the compliments.

I have never tried anything like this, but I think based on your wants/needs you could probably store the information in the Profile table. It has the UserId and a ProfileData field that you could put the password in.

If you want to use the DNN API to put info into that table you would use the Personalization object.

I would recommend using a one way Hash instead of encryption.  You can do that with a function like this:



        public static string GetMD5Hash(string raw)
        {
            MD5 md5serv = MD5CryptoServiceProvider.Create();
            byte[] hash;
            StringBuilder sb = new StringBuilder();
            ASCIIEncoding asciienc = new ASCIIEncoding();
            byte[] buffer = asciienc.GetBytes(raw);
            hash = md5serv.ComputeHash(buffer);
            foreach (byte b in hash)
            {
                sb.Append(b.ToString("x2"));
            }
            return sb.ToString();
        }
herchenx
Posts:3



09/11/2007 1:00 AM  

Cool, I think this addresses both my concerns. I did 5 minutes of digging and it looks like personalization is just something like this (untested):



String u = MyUsername.Text;
String p = GetMD5Hash(MyPassword.Text);
DotNetNuke.Services.Personalization.Personalization.SetProfile("MyModuleName","MyUsername",u);
DotNetNuke.Services.Personalization.Personalization.SetProfile("MyModuleName","MyPassword",p);



So, to go ahead and put it out there, without digging up MD5 stuff (not too familiar with workings of it all) - how would I get the password back out when the time came?


String u = DotNetNuke.Services.Personalization.Personalization.GetProfile("MyModuleName","MyUsername");
String p = MagicVooDooMethod(DotNetNuke.Services.Personalization.Personalization.GetProfile("MyModuleName","MyPassword"));

I did find the MSDN article explaining a bit more of the method you referenced. http://msdn2.microsoft.com/en-us/library/system.security.cryptography.md5cryptoserviceprovider.aspx

I think I am close, I've been going for 20 hours straight on several projects so everything is getting fuzzy right now. Any more pointers would be very welcome. Thanks for the help.

John Mitchell
Posts:3084



09/11/2007 6:45 AM  
MD5 is a one way Hash so if you store your password using this method you can never use the stored value and retrieve the original password. This is what makes it so secure.

So what you would do is retrieve the hashed version, and then compare it to a password from the other system that has also been hashed. If both hashed values are the same, then the original passwords are the same.

It's very safe to pass around a hashed value over the network, and/or to pull it out into a hidden field of a webform.
herchenx
Posts:3



09/11/2007 12:15 PM  
Yeah ok I was really tired. Thanks for that, I do have the means to compare the password from the other app with the password stored on our app so I'll go ahead and do that.

Did the personalization stuff look close?

Thanks,

.john.
John Mitchell
Posts:3084



09/11/2007 3:31 PM  
Cool.
Yes, the personaliztion code looks right to me, then you just use GetProfile to retrieve it. Pretty easy..
Please Register to post a reply.
Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.

Forums >DotNetNuke Support >General-DNN-Help > Hiding Profile Properties from the admin searchable fields



ActiveForums 3.7
Visit our Store for great DotNetNuke Modules and Skins
DNNMasters Sitemap/Google Sitemap 3.0

Item codeSM3-01
Price$29.00
Product Information 
DotNetNuke CSS NavMenu 3.3 (Developers)

Item codeCSSNM33DEV
Base Price$149.00
Product Information 
Snapsis PageBlaster 3.3.2 for DotNetNuke - Professional Edition

AuthorJohn Mitchell
Base Price$79.00
Product Information