Password Generator Widget - Backend ready...

by Admin 13. April 2009 13:21

I took a few minutes last night and figured out the admin management / edit page and data storage for a widget.  In the end, very easy.  Blogengine stores the data in either the database or xml based on your provider settings for your site.  Everything I am doing is with an MSSQL database backend so in my case blogengine store that data to the be_DataStoreSettings table.  It very simply stores all of the settings for a widget in that table identifying the id of the widget and the settings for the widget in seperate fields.  In the settings field, all settings for the widget are stored as xml.  In the end the datastore table only has one record per widget.  It is a nice and clean model.

Because I utilized blogengines existing methods for reading and writing settings I am reasonably confident it will work fine for users using other backends (xml, mssql express, mysql, etc).  I would be interested in being contact by anyone interested and giving it a try for me.  Otherwise I will eventially spin up a fresh install and check it out myself.

End result...Now the data for the widget is stored in the database and can be managed from the edit page of the widget.  The settings are used when a password is generated instead of those fields being hard coded.  The fields are:

alpha characters - a list of the available alpha characters
friendly characters - a list of the additional characters that should be eligible with the alpha characters
strong characters - a list of the additional characters that should be eligible with the alpha characters
very strong characters - a list of the additional characters that should be eligible with the alpha characters

Retrieving these settings was done as simply as:

   1:  StringDictionary settings = GetSettings();
   2:          alphacharacters = settings.ContainsKey("pg_alphacharacters") ? settings["pg_alphacharacters"] : "abcdefghijkmnpqrstuvwxyz";
   3:          friendlycharacters = settings.ContainsKey("pg_friendlycharacters") ? settings["pg_friendlycharacters"] : "";
   4:          strongcharacters = settings.ContainsKey("pg_strongcharacters") ? settings["pg_strongcharacters"] : "1234567890";
   5:          verystrongcharacters = settings.ContainsKey("pg_verystrongcharacters") ? settings["pg_verystrongcharacters"] : "1234567890-_=+[]/.!@#$%^&*()";

Next step, a little more testing / cleanup then package it up and post it.

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



PasswordGenerator

Characters:    


 

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2012 Rendition17