*** empty log message ***

This commit is contained in:
Eric J. Bowersox
2003-05-20 03:25:31 +00:00
commit b80fa05ed1
682 changed files with 85738 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<!--
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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
-->
<dialog name="login" defaultbutton="login">
<title>Log In</title>
<action>login.js.vs</action>
<instructions><![CDATA[
Forgot your password? Enter your user name and click the <b>Reminder</b> button to receive a password
reminder via E-mail.
]]></instructions>
<hidden name="tgt"/>
<dynamo-id name="user" caption="User name" size="32" maxlength="64"/>
<password name="pass" caption="Password" size="32" maxlength="128"/>
<checkbox name="saveme" caption="Remember me for next time so I can log in automatically"/>
<button name="login"/>
<button name="reminder"/>
<button name="cancel"/>
</dialog>

View File

@@ -0,0 +1,46 @@
<?xml version="1.0"?>
<!--
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
-->
<dialog name="new_account" defaultbutton="create">
<title>Create Account</title>
<action>new_account_2.js.vs</action>
<instructions><![CDATA[
To create a new account, please enter your information below.
]]></instructions>
<hidden name="tgt" value=""/>
<header name="name_hdr" caption="Name"/>
<text name="prefix" caption="Prefix" caption2="(Mr., Ms., etc.)" size="8" maxlength="8"/>
<text name="first" caption="First Name" required="true" size="32" maxlength="64"/>
<text name="mid" caption="Middle initial" size="1" maxlength="1"/>
<text name="last" caption="Last Name" required="true" size="32" maxlength="64"/>
<text name="suffix" caption="Suffix" caption2="(Jr., III, etc.)" size="16" maxlength="16"/>
<header name="loc_hdr" caption="Location"/>
<text name="loc" caption="City" required="true" size="32" maxlength="64"/>
<text name="reg" caption="State/Province" required="true" size="32" maxlength="64"/>
<text name="pcode" caption="Zip/Postal Code" required="true" size="32" maxlength="64"/>
<countrylist name="country" caption="Country" required="true"/>
<header name="email_hdr" caption="E-Mail"/>
<email name="email" caption="E-mail address" required="true" size="32" maxlength="255"/>
<header name="inf_hdr" caption="Account Information"/>
<dynamo-id name="user" caption="User name" required="true" size="32" maxlength="64"/>
<password name="pass1" caption="Password" required="true" size="32" maxlength="128"/>
<password name="pass2" caption="Password" caption2="(retype)" required="true" size="32" maxlength="128"/>
<text name="remind" caption="Password reminder phrase" size="32" maxlength="255"/>
<button name="create"/>
<button name="cancel"/>
</dialog>

View File

@@ -0,0 +1,65 @@
<?xml version="1.0"?>
<!--
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
-->
<dialog name="user_profile" defaultbutton="update">
<title>Edit Your Profile</title>
<action>profile.js.vs</action>
<render-param name="rtgt"/>
<hidden name="tgt" value=""/>
<header name="pw_hdr" caption="Password">
To change your password, enter a new password into the fields below.
</header>
<password name="pass1" caption="Password" size="32" maxlength="128"/>
<password name="pass2" caption="Password" caption2="(retype)" size="32" maxlength="128"/>
<text name="remind" caption="Password reminder phrase" size="32" maxlength="255"/>
<header name="name_hdr" caption="Name"/>
<text name="prefix" caption="Prefix" caption2="(Mr., Ms., etc.)" size="8" maxlength="8"/>
<text name="first" caption="First Name" required="true" size="32" maxlength="64"/>
<text name="mid" caption="Middle initial" size="1" maxlength="1"/>
<text name="last" caption="Last Name" required="true" size="32" maxlength="64"/>
<text name="suffix" caption="Suffix" caption2="(Jr., III, etc.)" size="16" maxlength="16"/>
<header name="loc_hdr" caption="Location"/>
<text name="company" caption="Company" size="32" maxlength="255"/>
<text name="addr1" caption="Address" size="32" maxlength="255"/>
<text name="addr2" caption="Address" caption2="(line 2)" size="32" maxlength="255"/>
<checkbox name="pvt_addr" caption="Hide address in profile"/>
<text name="loc" caption="City" required="true" size="32" maxlength="64"/>
<text name="reg" caption="State/Province" required="true" size="32" maxlength="64"/>
<text name="pcode" caption="Zip/Postal Code" required="true" size="32" maxlength="64"/>
<countrylist name="country" caption="Country" required="true"/>
<header name="phone_hdr" caption="Phone Numbers"/>
<text name="phone" caption="Telephone" size="32" maxlength="32"/>
<checkbox name="pvt_phone" caption="Hide phone number in profile"/>
<text name="mobile" caption="Mobile/cellphone" size="32" maxlength="32"/>
<checkbox name="pvt_mobile" caption="Hide mobile phone number in profile"/>
<text name="fax" caption="Fax" size="32" maxlength="32"/>
<checkbox name="pvt_fax" caption="Hide fax number in profile"/>
<header name="email_hdr" caption="Internet"/>
<email name="email" caption="E-mail address" required="true" size="32" maxlength="255"/>
<checkbox name="pvt_email" caption="Hide E-mail address in profile"/>
<text name="url" caption="Home Page" caption2="(URL)" size="32" maxlength="255"/>
<header name="pers_hdr" caption="Personal"/>
<text name="descr" caption="Personal description" size="32" maxlength="255"/>
<userphoto name="photo" caption="User Photo" link="profile_photo.js.vs?tgt=${rtgt}" type="servlet"/>
<header name="prefs_hdr" caption="User Preferences"/>
<checkbox name="no_mass_mail" caption="Don't send me mass E-mail messages"/>
<localelist name="locale" caption="Default locale" caption2="(for formatting dates/times)" required="true"/>
<tzlist name="tz" caption="Default time zone" required="true"/>
<button name="update"/>
<button name="cancel"/>
</dialog>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<!--
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
-->
<dialog name="verify" defaultbutton="ok">
<title>Verify E-mail Address</title>
<action>verify_email.js.vs</action>
<instructions><![CDATA[
Check your E-mail, then enter the confirmation number that was E-mailed to you in the field below.
(The E-mail might take a few minutes or so to get to you, so be patient.) Once you do so, your account
will be fully validated. If you have not received your confirmation within a few minutes, click on the
<B>Send Again</B> button below.
]]></instructions>
<hidden name="tgt" value=""/>
<int name="num" caption="Confirmation Number" min="1000000" max="9999999"/>
<button name="ok"/>
<button name="send.again"/>
<button name="cancel"/>
</dialog>

View File

@@ -0,0 +1,219 @@
// 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importClass(Packages.com.silverwrist.dynamo.UserInfoNamespace);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.mail);
importPackage(Packages.com.silverwrist.dynamo.util);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importPackage(Packages.com.silverwrist.venice.frame);
importPackage(Packages.com.silverwrist.venice.session);
req = bsf.lookupBean("request"); // get request
rhelp = bsf.lookupBean("request_help"); // get request helper
target = rhelp.getParameterString("tgt"); // get the target for this operation
if (target==null)
target = "top.js.vs";
vlib.setOnError(req,target);
session = rhelp.getSession(); // get the session
user = vlib.getUser(session);
if (!(user.isAnonymous())) // user already logged in, just bounce back to where we came from
dynamo.scriptReturn(new Redirect("SERVLET",target));
// Load the login dialog.
loader = cast.queryDialogLoader(req);
dlg = loader.loadDialogResource("login.dlg.xml");
if (rhelp.isVerb("GET"))
{ // just display the dialog and return
dlg.setValue("tgt",target);
vlib.setLocation(req,target);
dynamo.scriptReturn(new FrameDialog(dlg));
} // end if
// everything that follows is for a POST operation
op = dlg.getClickedButton(req) + "";
if (op=="cancel") // user cancelled login - bounce back to the target
dynamo.scriptReturn(new Redirect("SERVLET",target));
dlg.load(req); // load dialog contents
if (op=="reminder")
{ // generate a password reminder
errmsg = null;
user = vlib.lookupUser(req,dlg.getValue("user"));
if (user!=null)
{ // user found...
if (user.isAnonymous()) // can't do this for the Anonymous_Honyak account
errmsg = "This account cannot be explicitly logged into. Please try again.";
else
{ // get the user's password reminder
reminder_msg = PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,
"password.reminder");
if (reminder_msg==null)
reminder_msg = "";
// generate and set authentication for the password recovery system
auth = vlib.randomRecoveryAuth() + "." + dynamo.currentTimeMillis();
user.setAuthenticationData(user,VeniceNamespaces.SESSION_CONTROL_NAMESPACE,"password.recovery","",auth);
// create and send the reminder E-mail message
mailprov = cast.queryMailMessageProvider(req);
msg = mailprov.createSystemMessage(req);
msg.addRecipient(MailMessage.RECIP_TO,user.getEMailAddress());
globals = vcast.getGlobalPropertiesStore(req);
msg.setSubject(globals.getObject(VeniceNamespaces.MAIL_MESSAGES_NAMESPACE,
"reminder.message.title").toString());
blocks = vcast.getGlobalBlocksStore(req);
msg.setText(blocks.getObject(VeniceNamespaces.MAIL_MESSAGES_NAMESPACE,"reminder.message").toString());
msg.setVariable("username",user.getName());
msg.setVariable("reminder",reminder_msg);
msg.setVariable("uid",cast.toIntegerObject(user.getUID()));
msg.setVariable("auth",auth);
msg.send();
// set the error message and prepare the dialog for reset
errmsg = "Password reminder has been sent to the E-mail address for user '" + user.getName() + "'.";
dlg.setValue("pass",null);
} // end else
} // end if
else // user not found - bounce back with an error message
errmsg = "The user account you have specified does not exist. Please try again.";
if (errmsg!=null)
{ // set the error message and bounce back the dialog
dlg.setErrorMessage(errmsg);
dlg.setValue("user",null);
dlg.setValue("pass",null);
vlib.setLocation(req,target);
dynamo.scriptOutput(new FrameDialog(dlg));
} // end if
else // this ain't right
dynamo.scriptOutput(new ErrorBox("Internal Error","Unknown outcome from password reminder",
"SERVLET",target));
} // end if
else if (op=="login")
{ // attempt to log the user in!
errmsg = null;
new_user = vlib.lookupUser(req,dlg.getValue("user"));
if (new_user!=null)
{ // the user is present - we can do this
if (new_user.isAnonymous())
{ // can't log in as Anonymous_Honyak, foo!
errmsg = "This account cannot be explicitly logged into. Please try again.";
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Anonymous user");
dlg.setValue("user",null);
dlg.setValue("pass",null);
} // end if
else if (new_user.isLocked())
{ // account locked out - sorry!
errmsg = "This account has been locked out. Please contact the system administrator for assistance.";
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Locked Account");
dlg.setValue("pass",null);
} // end else if
else
{ // OK, we can try to authenticate with this account!
if (new_user.authenticate(UserInfoNamespace.NAMESPACE,UserInfoNamespace.AUTH_DEFAULT,"",
dlg.getValue("pass")))
{ // authenticated OK - set user into session
logger.debug("User \"" + new_user.getName() + "\" logged in successfully");
session.setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_USER,new_user);
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.ok");
new_user.setLastAccessDate(new_user,new java.util.Date());
// Now set up this user's default objects.
dynamo.exec("/util/setup_user.js");
if (cast.toBoolean(dlg.getValue("saveme")))
{ // user wants a cookie - generate one
source = vlib.randomString(32);
auth = vlib.randomString(32);
try
{ // set the user authentication data
new_user.setAuthenticationData(new_user,VeniceNamespaces.SESSION_CONTROL_NAMESPACE,"cookie",
source,auth);
// save the persistent cookie value
cval = "VQAT2:" + new_user.getUID() + ":" + source + ":" + auth;
cctrl = cast.queryCookieControl(req);
cctrl.putPersistentCookie(venice_session.loginCookieName,cval,venice_session.loginCookieAge);
// set the cookie authentication source so we can delete the auth info later at logout
session.setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_COOKIE_AUTH_SOURCE,source);
} // end try
catch (e)
{ // ignore exception here
logger.warn("cookie setup process threw exception",e);
} // end catch
} // end if
// Has the user verified their E-mail address yet? If not, bounce them there.
if (PropertyUtils.hasProperty(new_user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,"confirmation.number"))
dynamo.scriptReturn(new Redirect("SERVLET","verify_email.js.vs?tgt="
+ stringutils.encodeURL(target)));
else
dynamo.scriptReturn(new Redirect("SERVLET",target));
} // end if
else
{ // the password is wrong - please try again
errmsg = "The password specified for this user account is incorrect. Please try again.";
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Bad password");
dlg.setValue("pass",null);
} // end else
} // end else
} // end if
else
{ // user not found - bounce back with an error message
errmsg = "The user account you have specified does not exist. Please try again.";
audit.write(req,null,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Bad username",
dlg.getValue("user"));
dlg.setValue("user",null);
dlg.setValue("pass",null);
} // end else
if (errmsg!=null)
{ // set the error message and bounce back the dialog
dlg.setErrorMessage(errmsg);
vlib.setLocation(req,target);
dynamo.scriptOutput(new FrameDialog(dlg));
} // end if
else
dynamo.scriptOutput(new ErrorBox("Internal Error","Unknown outcome from login","SERVLET",target));
} // end else if
else
{ // unknown command button pressed!
logger.error("no known button click on POST to login.js");
dynamo.scriptOutput(new ErrorBox("Internal Error","Unknown command button pressed","SERVLET",target));
} // end else

View File

@@ -0,0 +1,48 @@
// 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
importPackage(Packages.com.silverwrist.venice.session);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
req = bsf.lookupBean("request"); // get request
rhelp = bsf.lookupBean("request_help"); // get request helper
target = rhelp.getParameterString("tgt"); // get the target for this operation
if (target==null)
target = "top.js.vs";
vlib.setOnError(req,target);
session = rhelp.getSession(); // get the session
user = vlib.getUser(session);
if (!(user.isAnonymous()))
{ // dump the login cookie, if we have it set
cctrl = cast.queryCookieControl(req);
if (cctrl.isCookiePresent(venice_session.loginCookieName))
{ // get rid of the cookie and its associated cookie authentication, lest it clutter the database
source = session.getObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_COOKIE_AUTH_SOURCE);
user.clearAuthenticationData(user,VeniceNamespaces.SESSION_CONTROL_NAMESPACE,"cookie",source);
cctrl.deleteCookie(venice_session.loginCookieName);
} // end if
session.invalidate(); // this dumps the entire session
target = "top.js.vs"; // go back to the "top" display
} // end if
dynamo.scriptOutput(new Redirect("SERVLET",target)); // bounce back to the target

View File

@@ -0,0 +1,55 @@
// 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) 2002-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importPackage(Packages.com.silverwrist.venice.content);
req = bsf.lookupBean("request");
req_help = bsf.lookupBean("request_help");
target = req_help.getParameterString("tgt");
if (target==null)
target = "top.js.vs";
vlib.setOnError(req,target);
// Check the user account.
user = vlib.getUser(req);
if (!(user.isAnonymous())) // user already logged in, must log out first
dynamo.scriptReturn(new ErrorBox(null,"You cannot create a new account while logged in on an existing one. "
+ "You must log out first.",target));
// Get the user agreement title and subtitle.
globals = vcast.getGlobalPropertiesStore(req);
s_title = globals.getObject(VeniceNamespaces.CONTENT_LAF_NAMESPACE,"user.agreement.title");
s_subtitle = PropertyUtils.getPropertyNoErr(globals,VeniceNamespaces.CONTENT_LAF_NAMESPACE,
"user.agreement.subtitle");
// Get the content block provider.
csupp = vcast.queryContentBlockProvider(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,
"venice-content"));
// Construct the "User Agreement" page.
vlib.setDisplayLogin(req,false);
rc = new StdTextMessage(req);
rc.title = s_title;
if (s_subtitle!=null)
rc.subtitle = s_subtitle;
rc.content = csupp.getContentBlock("user.agreement");
rc.addButton("SERVLET","new_account_2.js.vs?tgt=" + stringutils.encodeURL(target),"i.accept");
rc.addButton("SERVLET",target,"i.decline");
dynamo.scriptOutput(rc);

View File

@@ -0,0 +1,173 @@
// 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(java.lang);
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importClass(Packages.com.silverwrist.dynamo.UserInfoNamespace);
importPackage(Packages.com.silverwrist.dynamo.dialog);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.mail);
importPackage(Packages.com.silverwrist.dynamo.util);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importPackage(Packages.com.silverwrist.venice.frame);
importPackage(Packages.com.silverwrist.venice.session);
req = bsf.lookupBean("request");
req_help = bsf.lookupBean("request_help");
target = req_help.getParameterString("tgt");
if (target==null)
target = "top.js.vs";
vlib.setOnError(req,target);
// Check the user account.
user = vlib.getUser(req);
if (!(user.isAnonymous())) // user already logged in, must log out first
dynamo.scriptReturn(new ErrorBox(null,"You cannot create a new account while logged in on an existing one. "
+ "You must log out first.",target));
// Load the new account dialog.
loader = cast.queryDialogLoader(req);
dlg = loader.loadDialogResource("new_account.dlg.xml");
if (req_help.isVerb("GET"))
{ // fill in the dialog for a GET and return it
dlg.setValue("tgt",target);
vlib.setLocation(req,target);
vlib.setDisplayLogin(req,false);
dynamo.scriptReturn(new FrameDialog(dlg));
} // end if
// everything that follows is for a POST operation
op = dlg.getClickedButton(req) + "";
if (op=="cancel") // user cancelled login - bounce back to the target
dynamo.scriptReturn(new Redirect("SERVLET",target));
dlg.load(req); // load dialog contents
try
{ // validate the dialog contents
dlg.validate(req);
} // end try
catch (e)
{ // the validation failed - throw an error message
logger.error("Dialog validation failed",e);
dlg.setErrorMessage(dynamo.exceptionMessage(e) + " Please try again.");
vlib.setLocation(req,target);
vlib.setDisplayLogin(req,false);
dynamo.scriptReturn(new FrameDialog(dlg));
} // end catch
if (op=="create")
{ // check the two passwords
pass1 = dlg.getValue("pass1");
pass2 = dlg.getValue("pass2");
if (!(pass1.equals(pass2)))
{ // the two passwords don't match -
dlg.setErrorMessage("The passwords do not match. Please try again.");
vlib.setLocation(req,target);
vlib.setDisplayLogin(req,false);
dynamo.scriptReturn(new FrameDialog(dlg));
} // end if
// get the profile information to a local object store
temp_profile = new MemoryObjectStore("login profile");
PropertyUtils.setIfNonNull(temp_profile,VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.prefix",
dlg.getValue("prefix"));
temp_profile.setObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.given",dlg.getValue("first"));
s = dlg.getValue("mid");
if (s!=null)
temp_profile.setObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.mi",
new Character(s.toString().charAt(0)));
temp_profile.setObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.family",dlg.getValue("last"));
PropertyUtils.setIfNonNull(temp_profile,VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.suffix",
dlg.getValue("suffix"));
temp_profile.setObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"locality",dlg.getValue("loc"));
temp_profile.setObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"region",dlg.getValue("reg"));
temp_profile.setObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"postal.code",dlg.getValue("pcode"));
temp_profile.setObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"country",dlg.getValue("country"));
PropertyUtils.setIfNonNull(temp_profile,VeniceNamespaces.USER_SETTINGS_NAMESPACE,"password.reminder",
dlg.getValue("remind"));
// Create the DynamoUser object.
umgmt = cast.queryUserManagement(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"users"));
new_user = umgmt.createUser(dlg.getValue("user"),dlg.getValue("email"));
// Set the initial authentication info.
new_user.setAuthenticationData(new_user,UserInfoNamespace.NAMESPACE,UserInfoNamespace.AUTH_DEFAULT,"",pass1);
// Copy all default properties to this user.
udpns = vcast.queryUserDefaultPropertyNamespace(req);
umgmt.loadUserDefaults(new_user,udpns.getDefaultPropertyNamespaces());
// Set the "profile last updated" date for the user.
temp_profile.setObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"last.update",new_user.getCreationDate());
// Copy in the user properties.
if (!(PropertyUtils.copyPropertyNamespace(new_user,temp_profile,new_user,
VeniceNamespaces.USER_PROFILE_NAMESPACE)))
dynamo.scriptReturn(new ErrorBox("Internal Error","Unable to copy profile to new user.",target));
if (!(PropertyUtils.copyPropertyNamespace(new_user,temp_profile,new_user,
VeniceNamespaces.USER_SETTINGS_NAMESPACE)))
dynamo.scriptReturn(new ErrorBox("Internal Error","Unable to copy settings to new user.",target));
// Add this user to the "all users" group.
srm = cast.querySecurityReferenceMonitor(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,
"srm"));
srm.getAllUsersGroup().addMember(new_user);
// Write an audit message indicating the new user was created.
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"user.created");
// Generate an E-mail confirmation number and add it to the user properties.
confnum = vlib.randomConfirmationNumber();
new_user.setObject(new_user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,"confirmation.number",
cast.toIntegerObject(confnum));
// At this point, the user is completely set up, so act like we're logging in as that user.
req_help.getSession().setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_USER,new_user);
new_user.setLastAccessDate(new_user,new java.util.Date());
dynamo.exec("/util/setup_user.js");
// Generate and send an E-mail message to the user with the confirmation number.
mailprov = cast.queryMailMessageProvider(req);
msg = mailprov.createSystemMessage(req);
msg.addRecipient(MailMessage.RECIP_TO,new_user.getEMailAddress());
globals = vcast.getGlobalPropertiesStore(req);
msg.setSubject(globals.getObject(VeniceNamespaces.MAIL_MESSAGES_NAMESPACE,
"confirm.message.title").toString());
blocks = vcast.getGlobalBlocksStore(req);
msg.setText(blocks.getObject(VeniceNamespaces.MAIL_MESSAGES_NAMESPACE,"confirm.message").toString());
msg.setVariable("username",new_user.getName());
msg.setVariable("confnum",cast.toIntegerObject(confnum));
msg.send();
// Write an audit message.
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"send.confirm.email",
new_user.getEMailAddress());
// Now bounce us to the "verification" dialog.
dynamo.scriptOutput(new Redirect("SERVLET","verify_email.js.vs?tgt=" + stringutils.encodeURL(target)));
} // end if
else
{ // unknown command button pressed!
logger.error("no known button click on POST to new_account_2.js");
dynamo.scriptOutput(new ErrorBox("Internal Error","Unknown command button pressed","SERVLET",target));
} // end else

View File

@@ -0,0 +1,274 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(java.lang);
importPackage(Packages.com.silverwrist.util);
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importClass(Packages.com.silverwrist.dynamo.UserInfoNamespace);
importPackage(Packages.com.silverwrist.dynamo.dialog);
importPackage(Packages.com.silverwrist.dynamo.except);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.mail);
importPackage(Packages.com.silverwrist.dynamo.security);
importPackage(Packages.com.silverwrist.dynamo.util);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importPackage(Packages.com.silverwrist.venice.frame);
importPackage(Packages.com.silverwrist.venice.session);
req = bsf.lookupBean("request");
req_help = bsf.lookupBean("request_help");
target = req_help.getParameterString("tgt");
if (target==null)
target = "top.js.vs";
vlib.setOnError(req,target);
// Check the user account.
user = vlib.getUser(req);
if (user.isAnonymous())
{ // user not logged in, must log in first - so bounce us to the login dialog
new_target = "profile.js.vs?tgt=" + stringutils.encodeURL(target);
dynamo.scriptReturn(new Redirect("SERVLET","login.js.vs?tgt=" + stringutils.encodeURL(new_target)));
} // end if
// Create the profile dialog.
loader = cast.queryDialogLoader(req);
dlg = loader.loadDialogResource("user_profile.dlg.xml");
if (req_help.isVerb("GET"))
{ // Get the privacy settings and admin flags.
priv = cast.toOptionSet(user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"privacy"));
admin_flags = cast.toOptionSet(user.getObject(VeniceNamespaces.USER_SETTINGS_NAMESPACE,"admin.flags"));
// Fill in dialog and return it for a GET.
dlg.setValue("tgt",target);
// N.B.: do not set pass1, pass2, or remind
dlg.setValue("prefix",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"name.prefix"));
dlg.setValue("first",user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.given"));
dlg.setValue("mid",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"name.mi"));
dlg.setValue("last",user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.family"));
dlg.setValue("suffix",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"name.suffix"));
dlg.setValue("company",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"company.name"));
dlg.setValue("addr1",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"address.1"));
dlg.setValue("addr2",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"address.2"));
dlg.setValue("pvt_addr",cast.booleanObject(priv.get(0)));
dlg.setValue("loc",user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"locality"));
dlg.setValue("reg",user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"region"));
dlg.setValue("pcode",user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"postal.code"));
dlg.setValue("country",user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"country"));
dlg.setValue("phone",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"phone.voice"));
dlg.setValue("pvt_phone",cast.booleanObject(priv.get(1)));
dlg.setValue("mobile",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"phone.mobile"));
dlg.setValue("pvt_mobile",cast.booleanObject(priv.get(2)));
dlg.setValue("fax",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"phone.fax"));
dlg.setValue("pvt_fax",cast.booleanObject(priv.get(3)));
dlg.setValue("email",user.getEMailAddress());
dlg.setValue("pvt_email",cast.booleanObject(priv.get(4)));
dlg.setValue("url",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"url.homepage"));
dlg.setValue("descr",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"description"));
dlg.setValue("photo",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"url.photo"));
if (dlg.getValue("photo")==null)
{ // fill in the "no photo" URL
globals = vcast.getGlobalPropertiesStore(req);
url = globals.getObject(VeniceNamespaces.CONTENT_LAF_NAMESPACE,"user.nophoto.url");
urltype = globals.getObject(VeniceNamespaces.CONTENT_LAF_NAMESPACE,"user.nophoto.url.type");
rewriter = cast.queryURLRewriter(req);
dlg.setValue("photo",rewriter.rewriteURL(urltype,url));
} // end if
if (admin_flags.get(0))
dlg.setEnabled("photo",false);
dlg.setValue("no_mass_mail",cast.booleanObject(user.isNoSpam()));
dlg.setValue("locale",user.getObject(VeniceNamespaces.USER_SETTINGS_NAMESPACE,"locale"));
dlg.setValue("tz",user.getObject(VeniceNamespaces.USER_SETTINGS_NAMESPACE,"timezone"));
// prepare the dialog and return it
dlg.setRenderParam("rtgt",stringutils.encodeURL(target));
vlib.setLocation(req,target);
vlib.setDisplayLogin(req,false);
dynamo.scriptReturn(new FrameDialog(dlg));
} // end if
// everything that follows here is for a POST operation
op = dlg.getClickedButton(req) + "";
if (op=="cancel") // user cancelled login - bounce back to the target
dynamo.scriptReturn(new Redirect("SERVLET",target));
dlg.load(req); // load dialog contents
try
{ // validate the dialog contents
dlg.validate(req);
// if a new password has been specified, make sure it was properly specified twice
pass1 = dlg.getValue("pass1");
pass2 = dlg.getValue("pass2");
if (stringutils.isNotEmpty(pass1))
{ // dest password equality
if (stringutils.isEmpty(pass2) || !(pass1.equals(pass2)))
throw new DynamoException("The specified passwords do not match.");
} // end if
else if (stringutils.isNotEmpty(pass2))
throw new DynamoException("The specified passwords do not match.");
} // end try
catch (e)
{ // the validation failed - throw an error message
logger.error("Dialog validation failed",e);
dlg.setErrorMessage(dynamo.exceptionMessage(e) + " Please try again.");
// have to re-prep the user photo
dlg.setValue("photo",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"url.photo"));
if (dlg.getValue("photo")==null)
{ // fill in the "no photo" URL
globals = vcast.getGlobalPropertiesStore(req);
url = globals.getObject(VeniceNamespaces.CONTENT_LAF_NAMESPACE,"user.nophoto.url");
urltype = globals.getObject(VeniceNamespaces.CONTENT_LAF_NAMESPACE,"user.nophoto.url.type");
rewriter = cast.queryURLRewriter(req);
dlg.setValue("photo",rewriter.rewriteURL(urltype,url));
} // end if
if (admin_flags.get(0))
dlg.setEnabled("photo",false);
dlg.setRenderParam("rtgt",stringutils.encodeURL(target));
vlib.setLocation(req,target);
vlib.setDisplayLogin(req,false);
dynamo.scriptReturn(new FrameDialog(dlg));
} // end catch
if (op=="update")
{ // get the user privacy settings
priv = cast.toOptionSet(user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"privacy"));
// poke in all the updates for the user!
PropertyUtils.setOrRemove(user,user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.prefix",
dlg.getValue("prefix"));
user.setObject(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.given",dlg.getValue("first"));
s = dlg.getValue("mid");
if (s!=null)
user.setObject(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.mi",
new Character(s.toString().charAt(0)));
else
user.removeObject(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.mi");
user.setObject(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.family",dlg.getValue("last"));
PropertyUtils.setOrRemove(user,user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.suffix",
dlg.getValue("suffix"));
PropertyUtils.setOrRemove(user,user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"company.name",
dlg.getValue("company"));
PropertyUtils.setOrRemove(user,user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"address.1",
dlg.getValue("addr1"));
PropertyUtils.setOrRemove(user,user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"address.2",
dlg.getValue("addr2"));
priv.set(0,cast.toBoolean(dlg.getValue("pvt_addr")));
user.setObject(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"locality",dlg.getValue("loc"));
user.setObject(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"region",dlg.getValue("reg"));
user.setObject(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"postal.code",dlg.getValue("pcode"));
user.setObject(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"country",dlg.getValue("country"));
PropertyUtils.setOrRemove(user,user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"phone.voice",
dlg.getValue("phone"));
priv.set(1,cast.toBoolean(dlg.getValue("pvt_phone")));
PropertyUtils.setOrRemove(user,user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"phone.mobile",
dlg.getValue("mobile"));
priv.set(2,cast.toBoolean(dlg.getValue("pvt_mobile")));
PropertyUtils.setOrRemove(user,user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"phone.fax",
dlg.getValue("fax"));
priv.set(3,cast.toBoolean(dlg.getValue("pvt_fax")));
reverify = user.setEMailAddress(user,dlg.getValue("email"));
priv.set(4,cast.toBoolean(dlg.getValue("pvt_email")));
PropertyUtils.setOrRemove(user,user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"url.homepage",
dlg.getValue("url"));
PropertyUtils.setOrRemove(user,user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"description",
dlg.getValue("descr"));
user.setNoSpam(user,cast.toBoolean(dlg.getValue("no_mass_mail")));
user.setObject(user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,"locale",dlg.getValue("locale"));
user.setObject(user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,"timezone",dlg.getValue("tz"));
user.setObject(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"privacy",priv);
// Set the "profile last updated" date for the user.
user.setObject(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"last.update",dynamo.currentDate());
// Reset the password.
pass = dlg.getValue("pass1");
if (stringutils.isNotEmpty(pass1))
{ // set the password and reminder
user.setAuthenticationData(user,UserInfoNamespace.NAMESPACE,UserInfoNamespace.AUTH_DEFAULT,"",pass);
PropertyUtils.setOrRemove(user,user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,"password.reminder",
dlg.getValue("remind"));
} // end if
if (!reverify) // all done - we can go back where we came from
dynamo.scriptReturn(new Redirect("SERVLET",target));
// The user might not need to re-verify - test this
srm = cast.querySecurityReferenceMonitor(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,
"srm"));
if (srm.getGlobalAcl().testPermission(user,Namespaces.DYNAMO_USER_INFO_NAMESPACE,"bypass.email.verify"))
dynamo.scriptReturn(new Redirect("SERVLET",target));
// User needs to be re-verified - generate a new confirmation number
confnum = vlib.randomConfirmationNumber();
user.setObject(user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,"confirmation.number",
cast.toIntegerObject(confnum));
// remove us from Verified Users for the nonce
srm.getVerifiedUsersGroup().removeMember(user);
// Generate and send an E-mail message to the user with the confirmation number.
mailprov = cast.queryMailMessageProvider(req);
msg = mailprov.createSystemMessage(req);
msg.addRecipient(MailMessage.RECIP_TO,new_user.getEMailAddress());
globals = vcast.getGlobalPropertiesStore(req);
msg.setSubject(globals.getObject(VeniceNamespaces.MAIL_MESSAGES_NAMESPACE,
"confirm.message.title").toString());
blocks = vcast.getGlobalBlocksStore(req);
msg.setText(blocks.getObject(VeniceNamespaces.MAIL_MESSAGES_NAMESPACE,"confirm.message").toString());
msg.setVariable("username",new_user.getName());
msg.setVariable("confnum",cast.toIntegerObject(confnum));
msg.send();
// Write an audit message.
audit.write(req,user,VeniceNamespaces.USER_EVENT_NAMESPACE,"send.confirm.email",user.getEMailAddress());
// Now bounce us to the "verification" dialog.
dynamo.scriptOutput(new Redirect("SERVLET","verify_email.js.vs?tgt=" + stringutils.encodeURL(target)));
} // end if
else
{ // unknown command button pressed!
logger.error("no known button click on POST to profile.js");
dynamo.scriptOutput(new ErrorBox("Internal Error","Unknown command button pressed","SERVLET",target));
} // end else

View File

@@ -0,0 +1,109 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(Packages.com.silverwrist.util);
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importClass(Packages.com.silverwrist.dynamo.db.ImageStore);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importPackage(Packages.com.silverwrist.venice.content);
req = bsf.lookupBean("request");
req_help = bsf.lookupBean("request_help");
target = req_help.getParameterString("tgt");
if (target==null)
target = "top.js.vs";
on_error = "profile.js.vs?tgt=" + stringutils.encodeURL(target);
vlib.setOnError(req,on_error);
// Check the user account.
user = vlib.getUser(req);
if (user.isAnonymous())
{ // user not logged in, must log in first - so bounce us to the login dialog
new_target = "profile_photo.js.vs?tgt=" + stringutils.encodeURL(target);
dynamo.scriptReturn(new Redirect("SERVLET","login.js.vs?tgt=" + stringutils.encodeURL(new_target)));
} // end if
// Make sure they can actually edit their own photo.
admin_flags = cast.toOptionSet(user.getObject(VeniceNamespaces.USER_SETTINGS_NAMESPACE,"admin.flags"));
if (admin_flags.get(0))
dynamo.scriptReturn(new Redirect("SERVLET",on_error));
if (req_help.isVerb("GET"))
{ // on GET, display the form
view = new VelocityView("Set User Photo","user/user_photo.vm");
view.setParameter("target",target);
dynamo.scriptReturn(view);
} // end if
// everything from this point on is a POST operation
if (req_help.isImageButtonClicked("cancel"))
dynamo.scriptReturn(new Redirect("SERVLET",on_error));
// get the image provider object
imgprov = cast.queryImageStore(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"images"));
// figure out which image ID we have
imgid = imgprov.findImageID(VeniceNamespaces.USER_PROFILE_NAMESPACE,"user.photo",user);
selector = req_help.getParameterString("selector") + "";
if (selector=="none")
{ // take out the image property and the image
if (PropertyUtils.hasProperty(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"url.photo"))
user.removeObject(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"url.photo");
if (imgid!=-1)
imgprov.deleteImage(user,imgid);
} // end if
else if (selector=="set")
{ // set the image URL directly, delete the image
s = req_help.getParameterString("url");
if (stringutils.isEmpty(s))
dynamo.scriptReturn(new ErrorBox(null,"No photo URL specified.",on_error));
user.setObject(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"url.photo",s);
if (imgid!=-1)
imgprov.deleteImage(user,imgid);
} // end else if
else if (selector=="upload")
{ // take the uploaded image, reformat it, and save it off, then set the image URL
input_di = req_help.getDataItem("image");
if (input_di==null)
dynamo.scriptReturn(new ErrorBox(null,"No uploaded photo specified.",on_error));
mtype = input_di.getMimeType();
if (!(mtype.startsWith("image/")))
dynamo.scriptReturn(new ErrorBox(null,"Uploaded data item is not an image.",on_error));
globals = vcast.getGlobalPropertiesStore(req);
width = cast.toInteger(globals.getObject(VeniceNamespaces.CONTENT_LAF_NAMESPACE,"user.photo.width"));
height = cast.toInteger(globals.getObject(VeniceNamespaces.CONTENT_LAF_NAMESPACE,"user.photo.height"));
di = imgprov.normalizeImage(input_di,width,height,"image/jpeg");
if (imgid!=-1)
imgprov.replaceImage(user,imgid,di);
else
imgid = imgprov.saveNewImage(VeniceNamespaces.USER_PROFILE_NAMESPACE,"user.photo",user,di);
rewriter = cast.queryURLRewriter(req);
user.setObject(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"url.photo",
rewriter.rewriteURL("IMAGEDATA",imgid + ""));
} // end else if
else // return a "No Content" and just leave the dialog box up
dynamo.scriptReturn(new NoContent());
// All done - bounce back to the Profile dialog
dynamo.scriptOutput(new Redirect("SERVLET",on_error));

View File

@@ -0,0 +1,48 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.mail);
importPackage(Packages.com.silverwrist.dynamo.util);
importPackage(Packages.com.silverwrist.venice.content);
req = bsf.lookupBean("request");
req_help = bsf.lookupBean("request_help");
me = vlib.getUser(req);
to_uid = req_help.getParameterInt("to_uid",-1);
if (to_uid<=0)
dynamo.scriptReturn(new ErrorBox(null,"Invalid user ID parameter."));
on_error = "top.js.vs";
user = vlib.lookupUser(req,to_uid);
if (user==null)
dynamo.scriptReturn(new ErrorBox(null,"Invalid user ID parameter.",on_error));
on_error = "user/" + user.getName();
vlib.setOnError(req,on_error);
logger.debug("sending quick email message to " + user.getName());
// compose the E-mail message
mailprov = cast.queryMailMessageProvider(req);
msg = mailprov.createUserMessage(req,me);
msg.addRecipient(MailMessage.RECIP_TO,user.getEMailAddress());
msg.setSubject(req_help.getParameterString("subj"));
msg.setText(req_help.getParameterString("pb"));
msg.send();
// all done - bounce back to the user's profile.
dynamo.scriptOutput(new Redirect("SERVLET","user/" + user.getName()));

View File

@@ -0,0 +1,43 @@
// 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) 2002-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(java.util);
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
importPackage(Packages.com.silverwrist.venice.frame);
req = bsf.lookupBean("request");
req_help = bsf.lookupBean("request_help");
// N.B. THIS IS ALL TEMPORARY
// Find the standard content supplier.
tmp = req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,"venice-content");
scs = vcast.queryContentBlockProvider(tmp);
// Get an instance of the content block representing the page title.
cblk = scs.getContentBlock("content.header");
cblk.setContentParameter("title","Content Title");
cblk.setContentParameter("subtitle","Content Subtitle");
// Put together a list of objects to render in order.
rc = new ArrayList();
rc.add(cblk);
rc.add("Temporary second return value");
// We're outta here.
dynamo.scriptReturn(new TempFramedContent(rc));

View File

@@ -0,0 +1,152 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.mail);
importPackage(Packages.com.silverwrist.dynamo.security);
importPackage(Packages.com.silverwrist.dynamo.util);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
req = bsf.lookupBean("request");
req_help = bsf.lookupBean("request_help");
target = req_help.getParameterString("tgt");
if (target==null)
target = "top.js.vs";
vlib.setOnError(req,target);
// Check the user account.
user = vlib.getUser(req);
if (user.isAnonymous())
{ // user not logged in, must log in first - so bounce us to the login dialog
new_target = "verify_email.js.vs?tgt=" + stringutils.encodeURL(target);
dynamo.scriptReturn(new Redirect("SERVLET","login.js.vs?tgt=" + stringutils.encodeURL(new_target)));
} // end if
// If user is already verified, this is a no-op.
if (!PropertyUtils.hasProperty(user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,"confirmation.number"))
dynamo.scriptReturn(new Redirect("SERVLET",target));
confnum = cast.toInteger(user.getObject(VeniceNamespaces.USER_SETTINGS_NAMESPACE,"confirmation.number"));
// Load the verification dialog.
loader = cast.queryDialogLoader(req);
dlg = loader.loadDialogResource("verify.dlg.xml");
if (req_help.isVerb("GET"))
{ // fill in the dialog for a GET and return it
dlg.setValue("tgt",target);
vlib.setLocation(req,target);
vlib.setDisplayLogin(req,false);
dynamo.scriptReturn(new FrameDialog(dlg));
} // end if
// Everything that follows is for a POST operation
op = dlg.getClickedButton(req) + "";
if (op=="cancel") // user cancelled verification - bounce us back to the target
dynamo.scriptReturn(new Redirect("SERVLET",target));
else if (op=="send.again")
{ // generate a new confirmation number before we re-send the message
confnum = vlib.randomConfirmationNumber();
user.setObject(user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,"confirmation.number",
cast.toIntegerObject(confnum));
// send the verification E-mail message again
mailprov = cast.queryMailMessageProvider(req);
msg = mailprov.createSystemMessage(req);
msg.addRecipient(MailMessage.RECIP_TO,user.getEMailAddress());
globals = vcast.getGlobalPropertiesStore(req);
msg.setSubject(globals.getObject(VeniceNamespaces.MAIL_MESSAGES_NAMESPACE,
"confirm.message.title").toString());
blocks = vcast.getGlobalBlocksStore(req);
msg.setText(blocks.getObject(VeniceNamespaces.MAIL_MESSAGES_NAMESPACE,"confirm.message").toString());
msg.setVariable("username",user.getName());
msg.setVariable("confnum",cast.toIntegerObject(confnum));
msg.send();
// Record an audit message.
audit.write(req,user,VeniceNamespaces.USER_EVENT_NAMESPACE,"resend.confirm.email",
user.getEMailAddress());
// bounce us back to the dialog
dlg.setErrorMessage("New confirmation message sent.");
dlg.setValue("tgt",target);
vlib.setLocation(req,target);
vlib.setDisplayLogin(req,false);
dynamo.scriptReturn(new FrameDialog(dlg));
} // end else if
dlg.load(req); // load dialog contents
try
{ // validate the dialog contents
dlg.validate(req);
} // end try
catch (e)
{ // the validation failed - throw an error message
logger.error("Verify E-Mail dialog failed validation",e);
dlg.setErrorMessage(dynamo.exceptionMessage(e) + " Please try again.");
dlg.setValue("num",null);
vlib.setLocation(req,target);
vlib.setDisplayLogin(req,false);
dynamo.scriptReturn(new FrameDialog(dlg));
} // end catch
if (op=="ok")
{ // the button has been pressed - is the confirmation number correct?
if (!(dlg.containsValue("num")))
{ // no confirmation number entered!!!
dlg.setErrorMessage("No confirmation number entered. Please try again.");
vlib.setLocation(req,target);
vlib.setDisplayLogin(req,false);
dynamo.scriptReturn(new FrameDialog(dlg));
} // end if
new_num = cast.toInteger(dlg.getValue("num"));
if (new_num!=confnum)
{ // confirmation numbers don't match - bogus!
audit.write(req,user,VeniceNamespaces.USER_EVENT_NAMESPACE,"verify.fail");
dlg.setErrorMessage("Sorry, the confirmation number doesn't match. Please try again.");
dlg.setValue("num",null);
vlib.setLocation(req,target);
vlib.setDisplayLogin(req,false);
dynamo.scriptReturn(new FrameDialog(dlg));
} // end if
// we're verified - remove our confirmation number attribute
audit.write(req,user,VeniceNamespaces.USER_EVENT_NAMESPACE,"verify.ok");
user.removeObject(user,VeniceNamespaces.USER_SETTINGS_NAMESPACE,"confirmation.number");
// add us to the "verified users" group
srm = cast.querySecurityReferenceMonitor(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,
"srm"));
srm.getVerifiedUsersGroup().addMember(user);
// and that does it - bounce us on to whereever we were going
dynamo.scriptOutput(new Redirect("SERVLET",target));
} // end if
else
{ // unknown command button pressed!
logger.error("no known button click on POST to verify_email.js");
dynamo.scriptOutput(new ErrorBox("Internal Error","Unknown command button pressed","SERVLET",target));
} // end else

View File

@@ -0,0 +1,120 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(java.lang);
importPackage(Packages.com.silverwrist.util);
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.security);
importPackage(Packages.com.silverwrist.dynamo.util);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importPackage(Packages.com.silverwrist.venice.content);
req = bsf.lookupBean("request"); // get request
req_help = bsf.lookupBean("request_help"); // get request helper
me = vlib.getUser(req); // get self
user = cast.queryDynamoUser(req.getObject("temp:","user")); // get user being displayed
// are we allowed to view "private" data?
view_all = me.equals(user);
if (!view_all)
{ // look to see if we're an administrator
srm = cast.querySecurityReferenceMonitor(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,
"srm"));
view_all = srm.getGlobalAcl().testPermission(me,Namespaces.DYNAMO_USER_INFO_NAMESPACE,"view.all");
} // end if
// create the view object
view = new VelocityView("User Profile: " + user.getName(),"user/profile.vm");
view.setPageQID("user/" + user.getName());
// get the privacy options for this user
priv = cast.toOptionSet(user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"privacy"));
// get the user photo renderer
uphoto = vcast.queryRenderImage(req_help.getRequestObject(VeniceNamespaces.DYNAMO_OBJECT_NAMESPACE,
"venice-userphoto"));
// set the view parameters
view.setParameter("uid",cast.toIntegerObject(user.getUID()));
view.setParameter("username",user.getName());
photo_url = PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"url.photo");
if (photo_url==null)
{ // get the "No Photo Available" default
globals = vcast.getGlobalPropertiesStore(req);
url = globals.getObject(VeniceNamespaces.CONTENT_LAF_NAMESPACE,"user.nophoto.url");
urltype = globals.getObject(VeniceNamespaces.CONTENT_LAF_NAMESPACE,"user.nophoto.url.type");
rewriter = cast.queryURLRewriter(req);
photo_url = rewriter.rewriteURL(urltype,url);
} // end if
view.setParameter("photo",uphoto.getRenderingObject(photo_url));
view.setParameter("date_create",user.creationDate);
view.setParameter("date_lastlogin",user.lastAccessDate);
view.setParameter("date_lastupdate",user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"last.update"));
buf = new StringBuffer();
s = PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.prefix");
if (s!=null)
buf.append(s).append(" ");
buf.append(user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.given")).append(" ");
ch = PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.mi");
if (ch!=null)
buf.append(ch).append(". ");
buf.append(user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.family"));
s = PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,"name.suffix");
if (s!=null)
buf.append(" ").append(s);
view.setParameter("fullname",buf.toString());
if (view_all || !(priv.get(4)))
view.setParameter("email",user.getEMailAddress());
view.setParameter("url",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"url.homepage"));
view.setParameter("company",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"company.name"));
if (view_all || !(priv.get(0)))
{ // add the address lines
view.setParameter("addr1",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"address.1"));
view.setParameter("addr2",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"address.2"));
} // end if
buf = new StringBuffer(user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"locality").toString());
buf.append(", ").append(user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"region"));
buf.append(" ").append(user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,"postal.code"));
view.setParameter("addr_last",buf.toString());
view.setParameter("country",cast.toCountry(user.getObject(VeniceNamespaces.USER_PROFILE_NAMESPACE,
"country")).getName());
if (view_all || !(priv.get(1)))
view.setParameter("phone",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"phone.voice"));
if (view_all || !(priv.get(3)))
view.setParameter("fax",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"phone.fax"));
if (view_all || !(priv.get(2)))
view.setParameter("mobile",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"phone.mobile"));
view.setParameter("description",PropertyUtils.getPropertyNoErr(user,VeniceNamespaces.USER_PROFILE_NAMESPACE,
"description"));
if (!(me.isAnonymous() || user.isAnonymous()))
view.setParameter("quick_email",Boolean.TRUE);
dynamo.scriptOutput(view); // all done!

View File

@@ -0,0 +1,62 @@
// 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(java.util);
importClass(Packages.com.silverwrist.dynamo.UserInfoNamespace);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.mail);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importPackage(Packages.com.silverwrist.venice.content);
importPackage(Packages.com.silverwrist.venice.session);
req = bsf.lookupBean("request"); // get request
req_help = bsf.lookupBean("request_help"); // get request
uid = req_help.getParameterString("uid");
auth = req_help.getParameterString("auth");
if ((uid==null) || (auth==null))
dynamo.scriptReturn(new ErrorBox(null,"Invalid parameters."));
user = vlib.lookupUser(req,cast.toInteger(uid));
if (user==null)
dynamo.scriptReturn(new ErrorBox(null,"User account not found."));
if (!(user.authenticate(VeniceNamespaces.SESSION_CONTROL_NAMESPACE,"password.recovery","",auth.toString())))
dynamo.scriptReturn(new ErrorBox(null,"Invalid password recovery request."));
// clear the old password recovery data
user.clearAuthenticationData(user,VeniceNamespaces.SESSION_CONTROL_NAMESPACE,"password.recovery");
// generate a new password and set it for the user
newpass = vlib.randomPassword();
user.setAuthenticationData(user,UserInfoNamespace.NAMESPACE,UserInfoNamespace.AUTH_DEFAULT,"",newpass);
// E-mail the user with a new password.
mailprov = cast.queryMailMessageProvider(req);
msg = mailprov.createSystemMessage(req);
msg.addRecipient(MailMessage.RECIP_TO,user.getEMailAddress());
globals = vcast.getGlobalPropertiesStore(req);
msg.setSubject(globals.getObject(VeniceNamespaces.MAIL_MESSAGES_NAMESPACE,
"password.change.message.title").toString());
blocks = vcast.getGlobalBlocksStore(req);
msg.setText(blocks.getObject(VeniceNamespaces.MAIL_MESSAGES_NAMESPACE,"password.change.message").toString());
msg.setVariable("username",user.getName());
msg.setVariable("password",newpass);
msg.send();
// Now pass back a "password changed" page.
vlib.setLocation(req,"top.js.vs"); // lie so we can get the "Log In" link up top
view = new VelocityView("Your Password Has Been Changed","password_changed.vm");
dynamo.scriptOutput(view);

View File

@@ -0,0 +1,67 @@
// 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importPackage(Packages.com.silverwrist.venice.session);
req = bsf.lookupBean("request"); // get request
rhelp = bsf.lookupBean("request_help"); // get request helper
if (rhelp.isRequestType("_SESSION") && rhelp.isVerb("PUT"))
{ // OK, this is a session-established event...
if (rhelp.isSessionType("HTTP"))
{ // Check to see if the user can automatically log in with a cookie.
cctrl = cast.queryCookieControl(req);
if (cctrl.isCookiePresent(venice_session.loginCookieName))
{ // retrieve and parse the cookie value
logged_in = false;
arr = stringutils.split(cctrl.getCookie(venice_session.loginCookieName),":");
s = arr[0] + "";
if (s=="VQAT2")
{ // get the user corresponding to the UID embedded in this object
new_user = vlib.lookupUser(req,cast.toInteger(arr[1]));
if (new_user!=null)
{ // attempt to authenticate with the cookie value
if (new_user.authenticate(VeniceNamespaces.SESSION_CONTROL_NAMESPACE,"cookie",arr[2],arr[3]))
{ // this is the real user we're logged in as - set it into the session
session = rhelp.getSession();
session.setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_USER,new_user);
session.setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_COOKIE_AUTH_SOURCE,arr[2]);
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.ok");
new_user.setLastAccessDate(new_user,new java.util.Date());
logged_in = true;
} // end if
// else authentication failed - just dump out
} // end if
// else we don't know this UID - bail out
} // end if
// else our cookie format does not match - bail out
if (!logged_in) // if we failed to log in with this cookie, delete it
cctrl.deleteCookie(venice_session.loginCookieName);
} // end if
// Now set up the established user (either the one that just logged in or Anonymous_Honyak).
dynamo.exec("/util/setup_user.js");
} // end if (session is HTTP)
} // end if (session-PUT event)

View File

@@ -0,0 +1,45 @@
// 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importPackage(Packages.com.silverwrist.venice.content);
importPackage(Packages.com.silverwrist.venice.session);
req = bsf.lookupBean("request"); // get request
rhelp = bsf.lookupBean("request_help"); // get request helper
session = rhelp.getSession(); // get session object
user = vlib.getUser(session); // get user object
// Create the date formatter object.
df = null;
try
{ // create the user date formatter bottom half
df = new UserDateFormatterBottomHalf(req,user);
} // end try
catch (e)
{ // create a default one if the user one throws any exceptions
df = new DefaultDateFormatterBottomHalf(req);
} // end catch
// Set the date formatter object into the session.
session.setObject(DateFormatterTopHalf.NAMESPACE,DateFormatterTopHalf.PROPERTY,df);
// clear any password-recovery authentication data for this user
user.clearAuthenticationData(user,VeniceNamespaces.SESSION_CONTROL_NAMESPACE,"password.recovery");

View File

@@ -0,0 +1,43 @@
#*
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) 2002-03 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
*#
## Define macros around the "std" object.
#macro( formatURL $type $url )$std.formatURL($type,$url)#end
#macro( encodeHTML $data )$std.encodeHTML($data)#end
#macro( encodeURL $data )$std.encodeURL($data)#end
#macro( render $obj )$std.renderObject($obj)#end
#macro( renderDialog $dlg )$std.renderDialog($dlg)#end
#macro( stacktrace $thr )$std.getStackTrace($thr)#end
## following are additions for Venice
#macro( comment $txt )#if( ${std_frame.getShowComments()} )<!-- $txt -->#end #end
#macro( formatDate $d )$std_datefmt.formatDate($d)#end
#macro( formatActivity $d )$std_datefmt.getActivityString($d)#end
#macro( header1 $title )$std.renderObject($std_content.header1($title))#end
#macro( header2 $title $subtitle )$std.renderObject($std_content.header2($title,$subtitle))#end
#macro( button $type $name )$std.renderObject($std_button.getButton($type,$name))#end

View File

@@ -0,0 +1,33 @@
#*
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
*#
## Begin by rendering the header and the content.
#render( $header )
#render( $content )
## Now render the buttons...
#if( $buttons.size() > 0 )
<div align="center">
#foreach( $btn in $buttons )
#if( $velocityCount > 1 )
## insert spaces between the buttons
&nbsp;&nbsp;
#end
<a href="#formatURL( $btn.linktype $btn.link )">#render( $btn.image )</a>
#end
</div>
#end

View File

@@ -0,0 +1,135 @@
#*
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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
*#
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>#encodeHTML( $pagetitle ) - #encodeHTML( $sitetitle )</title>
#if( $pgicon_url && $pgicon_ltyp && $pgicon_mime )
<link rel="icon" href="#formatURL( $pgicon_ltyp $pgicon_url )" type="$pgicon_mime" />
#end
#if( $favicon_url && $favicon_ltyp )
<link rel="SHORTCUT ICON" href="#formatURL( $favicon_ltyp $favicon_url )" />
#end
#if( !$ms_copyright_violations )
<meta name="MSSmartTagsPreventParsing" content="TRUE" />
#end
<link rel="stylesheet" href="#formatURL( "SERVLET" "stylesheet-base.css" )" type="text/css" />
</head>
<body>
#comment( "BEGIN PAGE HEADER" )
<table class="frametop" border="0" width="100%" cellpadding="2" cellspacing="0">
<tr valign="middle">
<td align="left" width="20%" cellpadding="2" class="frametop">
#comment( "Site logo" )
<div class="frametopleft">
<a href="$siteurl"><img src="#formatURL( $logourltype $logourl )" alt="$sitetitle"
width="$logowidth" height="$logoheight" border="0" /></a>
</div>
</td>
<td align="center" width="30%" cellpadding="2" class="frametop">
#comment( "Links to Front Page, Help, Find" )
<p><b><a class="frametop" href="#formatURL( "SERVLET" "top.js.vs" )">Front Page</a></b></p>
<p><b>
<a class="frametop" href="TODO">Help</a> | <a class="frametop" href="TODO">Find</a>
</b></p>
</td>
<td align="right" width="50%" cellpadding="2" class="frametop">
#comment( "Banner Ad" )
<div class="frametopright">
<img src="#formatURL( "IMAGE" "temp/banner-ad.jpg" )" alt="" width="468" height="60" border="0" />
</div>
</td>
</tr>
<tr valign="middle"><td align="center" colspan="3" class="frametop">
#set( $lenc = "#encodeURL( $location )" )
#if( $user.isAnonymous() )
You are not logged in
#if( $display_login )
- <a class="frametop" href="#formatURL( "SERVLET" "login.js.vs?tgt=$lenc" )">Log In</a>
| <a class="frametop"
href="#formatURL( "SERVLET" "new_account.js.vs?tgt=$lenc" )">Create Account</a>
#end
#else
You are logged in as <b>$user.Name</b>
#if( $display_login )
- <a class="frametop" href="#formatURL( "SERVLET" "logout.js.vs?tgt=$lenc" )">Log Out</a>
#if( $unverified )
| <a class="frametop"
href="#formatURL( "SERVLET" "verify_email.js.vs?tgt=$lenc" )">Verify E-Mail</a>
#end
| <a class="frametop" href="#formatURL( "SERVLET" "profile.js.vs?tgt=$lenc" )">Profile</a>
#end
#end
</td></tr>
</table>
#comment( "END PAGE HEADER" )
<table border="0" width="100%" cellpadding="2" cellspacing="0">
<tr valign="top">
<td align="left" width="120" class="frameleft">
#comment( "BEGIN LEFT SIDEBAR" )
<div class="frameleft">
Top/community menu thingee
</div>
<div>&nbsp;</div>
<div class="frameleft">#render( $fixed_menu )</div>
#comment( "END LEFT SIDEBAR" )
</td>
<td align="left" width="100%" bgcolor="white" class="framecontent">
#comment( "BEGIN PAGE CONTENT" )
<div class="framecontent">#render( $content )</div>
#comment( "END PAGE CONTENT" )
</td>
</tr>
<tr valign="top">
<td align="left" width="120" class="frameleft">&nbsp;</td>
<td align="left" width="100%" bgcolor="white" class="framefooter">
#comment( "PAGE FOOTER" )
<hr width="80%">
<table align="center" border="0" cellpadding="0" cellspacing="6">
<tr valign="top">
<td align="right" class="framefooter">$footer_text</td>
<td rowspan="2" align="left" class="framefooter">
#set( $width_logo = (129 * $flogoscale) / 100 )
#set( $height_logo = (103 * $flogoscale) / 100 )
<a href="http://venice.sourceforge.net/" target="_blank"><img
src="#formatURL ("IMAGE" "powered-by-venice.gif" )" alt="Powered By Venice"
width="$width_logo" height="$height_logo" border="0" /></a>
</td>
</tr>
<tr valign="top"><td align="right" class="framefooter">
#comment( "HITCOUNTER FOR QID: $qid" )
</td></tr>
</table>
#comment( "END PAGE FOOTER" )
</td>
</tr>
</table>
</body>
</html>

View File

@@ -0,0 +1,24 @@
#*
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
*#
#comment( "Password changed" )
#header1( "Your Password Has Been Changed" )
<p>The password for your account has been changed, and a new password has been E-mailed
to you at your account's defined E-mail address. (Check your E-mail again!). After
getting the new password, please log in and change your password (yes, again!) as soon
as possible.</p>
<div align="center"><a href="#formatURL( "SERVLET" "top.js.vs" )">Return To Front Page</a></div>

View File

@@ -0,0 +1,95 @@
#*
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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
*#
## More advanced stylesheet imported from the base one; styles usable by IE 4-6, Opera,
## Mozilla/Netscape 6+
body, body div, body p, body th, body td, body li, body dd {
font-size: x-small; /* WinIE 4/5 */
voice-family: "\"}\""; /* stops WinIE 4/5 */
voice-family: inherit;
font-size: small; /* IE6, Mozilla */
}
body td.frametop, body div.frametop, body p.frametop {
font-size: small;
voice-family: "\"}\"";
voice-family: inherit;
font-size: medium;
}
body td.smcontent, body div.smcontent, body p.smcontent {
font-size: xx-small;
voice-family: "\"}\"";
voice-family: inherit;
font-size: x-small;
}
body td.framefooter, body div.framefooter, body p.framefooter {
font-size: xx-small;
voice-family: "\"}\"";
voice-family: inherit;
font-size: x-small;
}
body span.chdrtitle {
font-size: large;
voice-family: "\"}\"";
voice-family: inherit;
font-size: x-large;
}
body span.chdrsubtitle {
font-size: small;
voice-family: "\"}\"";
voice-family: inherit;
font-size: medium;
}
body td.errorhead, body td.errorbody {
font-size: small;
voice-family: "\"}\"";
voice-family: inherit;
font-size: medium;
}
html>body, html>body div, html>body p, html>body th, html>body td, html>body li, html>body dd {
font-size: small; /* be nice to Opera */
}
html>body td.frametop, html>body div.frametop, html>body p.frametop {
font-size: medium;
}
html>body td.smcontent, html>body div.smcontent, html>body p.smcontent {
font-size: x-small;
}
html>body td.framefooter, html>body div.framefooter, html>body p.framefooter {
font-size: x-small;
}
html>body span.chdrtitle {
font-size: x-large;
}
html>body span.chdrsubtitle {
font-size: medium;
}
html>body td.errorhead, html>body td.errorbody {
font-size: medium;
}

View File

@@ -0,0 +1,99 @@
#*
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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
*#
## Simple stylesheet that Netscape 4 should understand; uses @import to hide more advanced
## rules, since NN4 doesn't grok @import
@import url("stylesheet-advanced.css");
body, div, p, th, td, li, dd {
/* these selectors are for Netscape Navigator 4 */
font-family: Arial, Helvetica, sans-serif;
font-size: 11px; /* pixels are the only thing that's safe */
}
body {
background-color: #9999ff;
}
.frametop {
color: #ffffff;
background-color: #6666cc;
font-size: 15px; /* only thing that's safe */
}
a.frametop, a.frametop:link, a.frametop:visited {
color: #ffff00;
}
div.frametopleft {
padding: 2px;
}
div.frametopright {
padding: 2px;
}
.frameleft {
color: #000000;
background-color: #9999ff;
}
.framecontent {
color: #000000;
background-color: #ffffff;
}
.content {
color: #000000;
background-color: #ffffff;
}
.smcontent {
color: #000000;
background-color: #ffffff;
font-size: 9px;
}
.framefooter {
color: #000000;
background-color: #ffffff;
font-size: 9px;
}
span.chdrtitle {
color: #3333aa;
font-weight: bold;
font-size: 24px;
}
span.chdrsubtitle {
color: #3333aa;
font-weight: bold;
font-size: 13px;
}
td.errorhead {
color: #ffffff;
background-color: #660000;
text-align: center;
font-size: 15px;
}
td.errorbody {
text-align: center;
font-size: 15px;
}

View File

@@ -0,0 +1,73 @@
#*
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
*#
#comment( "Profile for user - UID=$uid" )
#header2( "User Profile:" "$username" )
<table border="0" cellpadding="6" cellspacing="0"><tr valign="top">
<td align="left" class="smcontent">
<p>#render( $photo )<br clear="left" /></p>
<p class="smcontent">
#if( $date_create )
Account created:<br />#formatDate( $date_create )<br />
#end
#if( $date_lastlogin )
Last login:<br />#formatDate( $date_lastlogin )<br />
#end
#if( $date_lastupdate )
Profile last updated:<br />#formatDate( $date_lastupdate )<br />
#end
</p>
</td>
<td align="left" class="content">
<b>#encodeHTML( "$fullname" )</b><br />
#if( $email )
E-mail: <a href="mailto:$email">#encodeHTML( "$email" )</a><br />
#end
#if( $url )
URL: <a href="$url" target="Wander">#encodeHTML( "$url" )</a><br />
#end
#if( $company )#encodeHTML( "$company" )<br />#end
#if( $addr1 )#encodeHTML( "$addr1" )<br />#end
#if( $addr2 )#encodeHTML( "$addr2" )<br />#end
#if( $addr_last )#encodeHTML( "$addr_last" )<br />#end
#if( $country )#encodeHTML( "$country" )<br />#end
#if( $phone )Phone: #encodeHTML( "$phone" )<br />#end
#if( $fax )Fax: #encodeHTML( "$fax" )<br />#end
#if( $mobile )Mobile: #encodeHTML( "$mobile" )<br />#end
</td>
</tr></table><br />
#if( $description )
<em>#encodeHTML( "$description" )</em>
#end
#if( $quick_email )
<hr /><b>Send Quick E-Mail To ${username}:</b><br />
<form method="POST" action="#formatURL( "SERVLET" "quick_email.js.vs" )">
<input type="hidden" name="to_uid" value="$uid" />
<table border="0" cellpadding="0">
<tr valign="middle"><td align="left" class="content">
Subject: <input type="text" name="subj" size="65" maxlength="255" value="" />
</td></tr>
<tr valign="middle"><td align="left">
<textarea name="pb" wrap="hard" rows="7" cols="80"></textarea>
</td></tr>
<tr valign="middle"><td align="left" class="content">#button( "INPUT" "send.email" )</td></tr>
</table>
</form>
#end

View File

@@ -0,0 +1,39 @@
#*
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
*#
#header1( "Set User Photo" )
<form method="POST" enctype="multipart/form-data" action="#formatURL( "SERVLET" "profile_photo.js.vs" )">
<input type="hidden" name="tgt" value="$target" />
<table border="0" cellpadding="2" cellspacing="0">
<tr>
<td align="center"><input type="radio" name="selector" value="none" /></td>
<td align="left">No photo</td>
<td>&nbsp;</td>
</tr>
<tr>
<td align="center"><input type="radio" name="selector" value="set" /></td>
<td align="left">Set photo URL:</td>
<td align="left"><input type="text" name="url" value="" size="64" maxlength="254" /></td>
</tr>
<tr>
<td align="center"><input type="radio" name="selector" value="upload" /></td>
<td align="left">Upload photo:</td>
<td align="left"><input type="file" name="image" value="" size="64" maxlength="254" /></td>
</tr>
</table>
#button( "INPUT" "set" )&nbsp;&nbsp;#button( "INPUT" "cancel" )
</form>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0"?>
<!--
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
-->
<metadata-file>
<metadata method="venice:session.destroy">
<signature>
<param>string</param>
<return>boolean</return>
</signature>
<doc><![CDATA[
Ends a Venice session.
Parameter: The session identifier
Returns: Boolean TRUE value on success
]]></doc>
</metadata>
<metadata method="venice:session.login">
<signature>
<param>string</param>
<param>string</param>
<param>string</param>
<return>boolean</return>
</signature>
<doc><![CDATA[
Logs into a Venice session. Please note that you must create a new session with the venice:session.create
method before you log into it.
Parameters: The session identifier, user name, and password
Returns: Boolean TRUE value on success
]]></doc>
</metadata>
</metadata-file>

View File

@@ -0,0 +1,97 @@
// 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) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importClass(Packages.com.silverwrist.dynamo.UserInfoNamespace);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.util);
importPackage(Packages.com.silverwrist.dynamo.xmlrpc);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importPackage(Packages.com.silverwrist.venice.session);
importPackage(Packages.com.silverwrist.venice.xmlrpc);
req = bsf.lookupBean("request"); // get request
req_help = bsf.lookupBean("request_help"); // get request helper
session = req_help.getSession(); // get session
method = req.queryString + ""; // get method name
if (method=="venice:session.destroy")
{ // destroy - takes one parameter, the session ID
if (req.getParameters().size()!=1)
dynamo.scriptReturn(new XmlRpcParameterError("parameter count mismatch");
session.invalidate(); // invalidate the session
dynamo.scriptReturn(Boolean.TRUE);
} // end if
if (method=="venice:session.login")
{ // login - parameters are session ID, user name, and password
if (req.getParameters().size()!=3)
dynamo.scriptReturn(new XmlRpcParameterError("parameter count mismatch");
username = req_help.getParameterString("1");
password = req_help.getParameterString("2");
// Check to make sure the user isn't already logged in.
old_user = vlib.getUser(session);
if (!(old_user.isAnonymous()))
dynamo.scriptReturn(new FaultCode(VeniceFaultCodes.IS_LOGGEDIN,"session already logged in"));
// Perform the login.
new_user = vlib.lookupUser(req,username);
if (new_user!=null)
{ // the user is present - we can do this
if (new_user.isAnonymous())
{ // anonymous user account - can't log in
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Anonymous user");
dynamo.scriptReturn(new FaultCode(VeniceFaultCodes.USER_NOLOGIN,"account cannot be logged into"));
} // end if
if (new_user.isLocked())
{ // account is locked - we can't log in
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Locked Account");
dynamo.scriptReturn(new FaultCode(VeniceFaultCodes.USER_LOCKED,"account locked: " + username));
} // end if
if (new_user.authenticate(UserInfoNamespace.NAMESPACE,UserInfoNamespace.AUTH_DEFAULT,"",password))
{ // authentication successful - set this user into the session and return
logger.debug("User \"" + new_user.name + "\" logged in successfully");
session.setObject(SessionInfoParams.NAMESPACE,SessionInfoParams.ATTR_USER,new_user);
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.ok");
new_user.setLastAccessDate(new_user,new java.util.Date());
dynamo.exec("/util/setup_user.js");
dynamo.scriptReturn(Boolean.TRUE);
} // end if
else
{ // authentication failed
audit.write(req,new_user,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Bad password");
dynamo.scriptReturn(new FaultCode(VeniceFaultCodes.USER_NOAUTH,"authentication failed: " + username));
} // end else
} // end if
else
{ // the user is not found
audit.write(req,null,VeniceNamespaces.USER_EVENT_NAMESPACE,"login.fail","Bad username",username);
dynamo.scriptReturn(new FaultCode(VeniceFaultCodes.USER_NOTFOUND,"no such user: " + username));
} // end else
} // end if
// if get here, we don't grok the method name - return failure
dynamo.scriptOutput(new XmlRpcMethodNotFound(method));

View File

@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<!--
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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
Contributor(s):
-->
<metadata-file>
<metadata method="venice:siteinfo">
<signature>
<return>struct</return>
</signature>
<doc><![CDATA[
Returns a structure with various members that describe this server, including:
'dynamoVersion' - The DYNAMO Framework revision number.
'veniceVersion' - The Venice version number.
'siteName' - The name of this site.
'siteURL' - The URL to this site.
'siteContact' - The E-mail address of the contact person for this site (the site's administrator).
]]></doc>
</metadata>
</metadata-file>

View File

@@ -0,0 +1,53 @@
// 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) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
//
// Contributor(s):
importPackage(java.util);
importClass(Packages.com.silverwrist.dynamo.DynamoVersion);
importClass(Packages.com.silverwrist.dynamo.Namespaces);
importPackage(Packages.com.silverwrist.dynamo.iface);
importPackage(Packages.com.silverwrist.dynamo.security);
importPackage(Packages.com.silverwrist.dynamo.util);
importPackage(Packages.com.silverwrist.dynamo.xmlrpc);
importClass(Packages.com.silverwrist.venice.VeniceNamespaces);
importClass(Packages.com.silverwrist.venice.VeniceVersion);
req = bsf.lookupBean("request"); // get request
req_help = bsf.lookupBean("request_help"); // get request helper
method = req.queryString + ""; // get method name
if (method=="venice:siteinfo")
{ // return a structure with site information
rc = new Hashtable();
rc.put("dynamoVersion",DynamoVersion.VERSION);
rc.put("veniceVersion",VeniceVersion.VERSION);
// get globals to stuff into return structure
globals = vcast.getGlobalPropertiesStore(req);
rc.put("siteName",globals.getObject(VeniceNamespaces.FRAME_LAF_NAMESPACE,"site.title"));
rc.put("siteURL",globals.getObject(VeniceNamespaces.FRAME_LAF_NAMESPACE,"site.url"));
// get contact info for this server - the Administrator's E-mail address
srm = cast.querySecurityReferenceMonitor(req_help.getRequestObject(Namespaces.DYNAMO_OBJECT_NAMESPACE,
"srm"));
rc.put("siteContact",srm.getAdminUser().getEMailAddress());
// all done!
dynamo.scriptReturn(rc);
} // end if
// if get here, we don't grok the method name - return failure
dynamo.scriptOutput(new XmlRpcMethodNotFound(method));