|
From: <tre...@us...> - 2007-12-31 23:16:00
|
Revision: 657
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=657&view=rev
Author: trevorolio
Date: 2007-12-31 15:16:03 -0800 (Mon, 31 Dec 2007)
Log Message:
-----------
Fixed the rotted verification email setup. Requires the following additions:
To TOMCAT/conf/server.xml add
<Resource name="mailSession" auth="Container" type="javax.mail.Session" mail.smtp.host="localhost" />
<Environment name="mailDirectory" value="/tmp/" type="java.lang.String"/>
To ~/.m2/settings.xml add
<ogoglio.mailDirectory>
/tmp/
</ogoglio.mailDirectory>
Modified Paths:
--------------
maven/trunk/ogoglio-server/pom.xml
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java
maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/OgoglioServletBase.java
maven/trunk/ogoglio-server/src/main/resources/mail/EmailValidationTemplate.txt
maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml
maven/trunk/ogoglio-server/src/test/resources/basic-config.properties
Modified: maven/trunk/ogoglio-server/pom.xml
===================================================================
--- maven/trunk/ogoglio-server/pom.xml 2007-12-31 23:15:54 UTC (rev 656)
+++ maven/trunk/ogoglio-server/pom.xml 2007-12-31 23:16:03 UTC (rev 657)
@@ -286,6 +286,7 @@
<groupId>com.sun</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
+ <scope>provided</scope>
</dependency>
<!-- need MYSQL for tests -->
<dependency>
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java 2007-12-31 23:15:54 UTC (rev 656)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/persist/AccountPersistTasks.java 2007-12-31 23:16:03 UTC (rev 657)
@@ -54,16 +54,16 @@
record.setLastName(document.getLastName());
}
- if (document.getVoiceURI() != null && !equals(record.getVoiceURI(), document.getVoiceURI())){
+ if (document.getVoiceURI() != null && !equals(record.getVoiceURI(), document.getVoiceURI())) {
dirty = true;
record.setVoiceURI(document.getVoiceURI());
}
-
- if (document.getTextURI() != null && !equals(record.getTextURI(), document.getTextURI())){
+
+ if (document.getTextURI() != null && !equals(record.getTextURI(), document.getTextURI())) {
dirty = true;
record.setTextURI(document.getTextURI());
}
-
+
if (document.getPassword() != null && !record.isValidPassword(document.getPassword())) {
if (AccountRecord.cleanPassword(document.getPassword()) != null) {
dirty = true;
@@ -81,21 +81,21 @@
}
}
}
-
- if(document.getBodyConfigurationID() != -1 && document.getBodyConfigurationID() != record.getDefaultBodyConfigurationID()){
+
+ if (document.getBodyConfigurationID() != -1 && document.getBodyConfigurationID() != record.getDefaultBodyConfigurationID()) {
Query bodyConfigQuery = hibernateSession.getNamedQuery(BodyPersistTasks.BODY_CONFIGURATION_BY_ID);
bodyConfigQuery.setLong("bodyConfigurationID", document.getBodyConfigurationID());
- BodyConfigurationRecord bodyConfigRecord = (BodyConfigurationRecord)bodyConfigQuery.uniqueResult();
- if(bodyConfigRecord == null){
+ BodyConfigurationRecord bodyConfigRecord = (BodyConfigurationRecord) bodyConfigQuery.uniqueResult();
+ if (bodyConfigRecord == null) {
return Boolean.FALSE;
}
- if(!record.getUsername().equals(bodyConfigRecord.getOwnerUsername())){
+ if (!record.getUsername().equals(bodyConfigRecord.getOwnerUsername())) {
return Boolean.FALSE;
}
dirty = true;
record.setDefaultBodyConfigurationID(document.getBodyConfigurationID());
}
-
+
if (dirty) {
hibernateSession.update(record);
return Boolean.TRUE;
@@ -164,16 +164,19 @@
}
Query bodyDataQuery = hibernateSession.getNamedQuery(BodyPersistTasks.BODY_DATA);
- BodyDataRecord[] bodyDataRecords = (BodyDataRecord[])bodyDataQuery.list().toArray(new BodyDataRecord[0]);
- if(bodyDataRecords.length == 0){
+ BodyDataRecord[] bodyDataRecords = (BodyDataRecord[]) bodyDataQuery.list().toArray(new BodyDataRecord[0]);
+ if (bodyDataRecords.length == 0) {
throw new IllegalStateException("No body data records!");
}
BodyConfigurationRecord bodyConfRecord = new BodyConfigurationRecord(username, "Body", bodyDataRecords[0].getBodyDataID(), null);
hibernateSession.save(bodyConfRecord);
-
+
record = new AccountRecord(username, accountlevel, email, bodyConfRecord.getBodyConfigurationID(), null, null);
hibernateSession.save(record);
+ PendingEmailValidationRecord validationRec = new PendingEmailValidationRecord(username, email);
+ hibernateSession.save(validationRec);
+
return record;
}
};
Modified: maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/OgoglioServletBase.java
===================================================================
--- maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/OgoglioServletBase.java 2007-12-31 23:15:54 UTC (rev 656)
+++ maven/trunk/ogoglio-server/src/main/java/com/ogoglio/site/OgoglioServletBase.java 2007-12-31 23:16:03 UTC (rev 657)
@@ -37,6 +37,9 @@
try {
mailDir = new File((String)envCtx.lookup("ogoglio/mailDirectory"));
+ if(mailDir != null && mailDir.length() == 0){
+ mailDir = null;
+ }
} catch (NamingException e) {
} // The media directory is where the MediaServlet will store your models, textures, scripts, and space documents
Modified: maven/trunk/ogoglio-server/src/main/resources/mail/EmailValidationTemplate.txt
===================================================================
--- maven/trunk/ogoglio-server/src/main/resources/mail/EmailValidationTemplate.txt 2007-12-31 23:15:54 UTC (rev 656)
+++ maven/trunk/ogoglio-server/src/main/resources/mail/EmailValidationTemplate.txt 2007-12-31 23:16:03 UTC (rev 657)
@@ -1,7 +1,5 @@
-Hello from ${serviceName},
-
-Someone (maybe you) has requested that the address ${emailToValidate} be associated
-with an account at ${serviceName}. If that someone was you and you'd like to make that
+Someone (hopefully you) has requested that the address ${emailToValidate} be associated
+with an account at ${serviceURL}. If that someone was you and you'd like to make that
association, just click this link:
${validationURL}
@@ -9,8 +7,3 @@
If you did not make this request, don't worry. If you don't click that link then the
email will not be associated with the account and after a few days the request will be
deleted.
-
-Keep it real,
-
- - The folks from ${serviceName} at ${serviceURL}
-
Modified: maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml
===================================================================
--- maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml 2007-12-31 23:15:54 UTC (rev 656)
+++ maven/trunk/ogoglio-server/src/main/webapp/META-INF/context.xml 2007-12-31 23:16:03 UTC (rev 657)
@@ -2,10 +2,11 @@
<Context reloadable="true" path="/og" >
<Realm className="org.apache.catalina.realm.MemoryRealm" />
- <ResourceLink name="jdbc/space"
- global="ogoglioDB"
- type="javax.sql.DataSource"/>
+ <ResourceLink name="mail/Session" global="mailSession" type="javax.mail.Session"/>
+ <ResourceLink name="ogoglio/mailDirectory" global="mailDirectory" type="java.lang.String"/>
+ <ResourceLink name="jdbc/space" global="ogoglioDB" type="javax.sql.DataSource"/>
+
<ResourceLink name="ogoglio/mediaURL" global="mediaURL" type="java.lang.String"/>
<ResourceLink name="ogoglio/baseURL" global="baseURL" type="java.lang.String"/>
<ResourceLink name="ogoglio/baseSimURL" global="baseSimURL" type="java.lang.String"/>
Modified: maven/trunk/ogoglio-server/src/test/resources/basic-config.properties
===================================================================
--- maven/trunk/ogoglio-server/src/test/resources/basic-config.properties 2007-12-31 23:15:54 UTC (rev 656)
+++ maven/trunk/ogoglio-server/src/test/resources/basic-config.properties 2007-12-31 23:16:03 UTC (rev 657)
@@ -2,4 +2,5 @@
ogoglio.testSpaceNumber = ${ogoglio.testSpaceNumber}
ogoglio.baseUrl = ${ogoglio.baseURL}
ogoglio.mediaDirectory = ${ogoglio.mediaDirectory}
+ogoglio.mailDirectory = ${ogoglio.mailDirectory}
ogoglio.baseSimUrl = ${ogoglio.baseSimURL}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|