Reworked the sidebox implementation to depend less on the database and more

on XML config files...the implementation should now be much more customizable
and less klunky.  Added a provision for implementing "generic" (JSP-driven)
sideboxes.  Implemented the sidebox configure button on the front page
(finally!).  Implemented a random password generator class which will be used
in a future implementation of reminder-driven automatic forgotten-password
changing.  Fixed some minor funnies in SIG menu generation.
This commit is contained in:
Eric J. Bowersox
2001-11-04 05:57:58 +00:00
parent bf040973ba
commit 1c69955046
32 changed files with 2049 additions and 495 deletions

View File

@@ -0,0 +1,114 @@
/*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
*
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
* Copyright (C) 2001 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
*
* Contributor(s):
*/
package com.silverwrist.venice.security;
import java.util.Random;
public class PasswordGenerator
{
/*--------------------------------------------------------------------------------
* Static data members
*--------------------------------------------------------------------------------
*/
private static final String[] syllabary = {
"ba", "be", "bi", "bo", "bu",
"da", "de", "di", "do", "du",
"cha", "chi", "cho", "chu",
"fa", "fe", "fi", "fo", "fu",
"ga", "ge", "gi", "go", "gu",
"ha", "he", "hi", "ho", "hu",
"ja", "je", "ji", "jo", "ju",
"ka", "ke", "ki", "ko", "ku",
"la", "le", "li", "lo", "lu",
"ma", "me", "mi", "mo", "mu",
"na", "ne", "ni", "no", "nu",
"pa", "pe", "pi", "po", "pu",
"ra", "re", "ri", "ro", "ru",
"sa", "se", "si", "so", "su",
"sha", "she", "sho", "shu",
"ta", "te", "ti", "to", "tu",
"va", "ve", "vi", "vo", "vu",
"wa", "we", "wi", "wo", "wu",
"ya", "ye", "yi", "yo", "yu",
"za", "ze", "zi", "zo", "zu"
}; // 98 syllables
private static final char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String value; // the password value
/*--------------------------------------------------------------------------------
* Constructor
*--------------------------------------------------------------------------------
*/
public PasswordGenerator()
{
Random rng = new Random();
StringBuffer buf = new StringBuffer();
int i;
for (i=0; i<4; i++) // 4 random syllables
buf.append(syllabary[rng.nextInt(syllabary.length)]);
for (i=0; i<3; i++) // 3 random digits
buf.append(digits[rng.nextInt(digits.length)]);
value = buf.toString();
// total possible number of passwords = 92,236,816,000
} // end constructor
/*--------------------------------------------------------------------------------
* Overrides from class Object
*--------------------------------------------------------------------------------
*/
public String toString()
{
return value;
} // end toString
public boolean equals(Object obj)
{
if (obj==null)
return false; // trivial case
else if (obj==(Object)this)
return true; // trivial case
if (obj instanceof PasswordGenerator)
{ // compare value of PasswordHash argument to value
PasswordGenerator other = (PasswordGenerator)obj;
return value.equals(other.value);
} // end if
else
return value.equals(obj.toString());
} // end equals
public int hashCode()
{
return value.hashCode();
} // end hashCode
} // end class PasswordGenerator

View File

@@ -7,7 +7,7 @@
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
* language governing rights and limitations under the License.
*
* The Original Code is the Venice Web Community System.
* The Original Code is the Venice Web Communities System.
*
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
@@ -21,9 +21,18 @@ import java.security.MessageDigest;
public class PasswordHash
{
// Attributes
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private String value; // the hashed password value
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
public PasswordHash()
{
value = "";
@@ -84,11 +93,10 @@ public class PasswordHash
} // end constructor
protected void finalize()
{
value = null;
} // end finalize
/*--------------------------------------------------------------------------------
* Overrides from class Object
*--------------------------------------------------------------------------------
*/
public String toString()
{
@@ -108,17 +116,22 @@ public class PasswordHash
return value.equals(other.value);
} // end if
else if (obj instanceof String)
{ // compare string argument to value
String os = (String)obj;
return value.equals(os);
} // end else if
else
return false;
return value.equals(obj.toString());
} // end equals
public int hashCode()
{
return value.hashCode();
} // end hashCode
/*--------------------------------------------------------------------------------
* Test program
*--------------------------------------------------------------------------------
*/
public static void main(String[] args)
{
if (args.length<1)