- Fix forgot password email

- Rewrite forgot password to use the new MVC model.
- Show a dialog when the password has been sent.
This commit is contained in:
Paulo Gustavo Veiga
2012-06-16 15:59:59 -03:00
parent 8a638e8de6
commit 7d6b82c626
25 changed files with 532 additions and 569 deletions

View File

@@ -34,17 +34,21 @@ database.password=
#------------------------
mail.smtp.port=587
mail.smtp.host=smtp.gmail.com
mail.username=pveiga@gmail.com
mail.password=
mail.username=<gmail-user-account>
mail.password=<gmail-password>
mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.quitwait=false
#------------------------
# Domain address
# Emails configuration
#------------------------
mail.registrationEmail=root@localhost
mail.siteEmail=root@localhost
# "from" email account that will appear in the emails sent from the sender.
mail.serverSendEmail=root@localhost
# Support account that the users could use to contact you. This address will appear in emails and in some places in the site.
mail.supportEmail=root@localhost
##################################################################################
# Users Registration Configuration

View File

@@ -1,23 +1,23 @@
log4j.rootLogger=WARN, stdout, R
log4j.logger.com.wisemapping=WARN,stdout,R
log4j.logger.org.springframework=WARN,stdout,R
log4j.logger.org.codehaus.jackson=WARN,stdout,R
log4j.additivity.org.hibernate.SQL=false
# Stdout logger <20>
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p %c - %m%n
# File Writter Logger <20>
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=wisemapping.log
log4j.appender.R.MaxFileSize=100KB
# Keep one backup file
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d %p %c - %m%n
log4j.rootLogger=WARN, stdout, R
log4j.logger.com.wisemapping=WARN,stdout,R
log4j.logger.org.springframework=DEBUG,stdout,R
log4j.logger.org.codehaus.jackson=WARN,stdout,R
log4j.additivity.org.hibernate.SQL=false
# Stdout logger <20>
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %p %c - %m%n
# File Writter Logger <20>
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=wisemapping.log
log4j.appender.R.MaxFileSize=100KB
# Keep one backup file
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d %p %c - %m%n

View File

@@ -1,24 +1,37 @@
<html>
<body>
<h3>Your password was regenerated from WiseMapping!</h3>
<p>
Your account information is:
</p>
User Login: ${user.email}
</p>
<p>
New Password: ${password}
</p>
<p>
Thank you for using WiseMapping.
</p>
<p>
For questions or concerns regarding your account, send us an email to support@wisemapping.com.
</p>
<p>
Best Regards, <br/>
The WiseMapping Team.
<a href="http://www.wisemapping.com">WiseMapping Site</a>
<div style="background-color: #fbeed5; max-width: 650px; font-family: Arial, sans-serif; color: #000; padding: 5px;">
<div style="height: 60px; font-size: 14px; font-weight: bold; padding-bottom: 4px;">
<table style="display: inline;width: 100%;">
<tbody>
<tr>
<td height="50px" width="2px"
style="padding: 0; padding-right: 5px; text-align:center;font-weight: normal;font-family: Arial, sans-serif">
<a href="${baseUrl}">
<img style="border: 0;margin-top: 10px;"
src="${baseUrl}/images/logo-small.png"
alt="WiseMapping Log"/>
</a>
</td>
<td valign="bottom" height="32px" style="padding: 0;font-size: 16px;">
Your password has been reset
</td>
</tr>
</tbody>
</table>
</div>
<div style="font-size: 13px; background-color: #FFF; padding: 10px 7px 7px 7px; min-height: 100px">
<p>A temporal password has been generated for you account. </p>
<p><strong>New Password: ${password}</strong></p>
<p>You can login clicking <a href="${baseUrl}/c/login">here</a>.We strongly encourage you to change the password as soon as possible.</p>
</div>
</div>
<p style="font-size: 13px;font-family: Arial, sans-serif">Important: Do not reply this email. If
you need further help or have any concerns regarding your account, contact us to <a href="mailto:${supportEmail}">here</a>.
</p>
</body>
</html>

View File

@@ -90,7 +90,7 @@ CREW=The Crew
ALREADY_A_MEMBER=Already a member?
WORD_VERIFICATION=Word Verification
TERM_OF_THE_SERVICE=Terms of Service:
FORGOT_PASSWORD_MESSAGE=Please enter your email to start the password recovery process.
FORGOT_PASSWORD_MESSAGE=Please enter an email address to help us locate your WiseMapping account.
SEARCH_FIELD=Map Title or Tag
FIELD_REQUIRED=Required field cannot be left blank

View File

@@ -1,6 +1,6 @@
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
"http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
"http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
<tiles-definitions>
@@ -30,19 +30,19 @@
</definition>
<definition name="errorTemplate" extends="pageTemplate">
<put-attribute name="body" value="/jsp/errorTemplate.jsp" type="page"/>
<put-attribute name="body" value="/jsp/errorTemplate.jsp"/>
</definition>
<definition name="iframeWrapper" template="/jsp/iframeWrapper.jsp"/>
<!-- Error Pages -->
<definition name="gcfPluginNeeded" extends="pageTemplate">
<put-attribute name="body" value="/jsp/gcfPluginNeeded.jsp" type="page"/>
<put-attribute name="body" value="/jsp/gcfPluginNeeded.jsp"/>
<put-attribute name="title" value="INSTALL_CFG"/>
</definition>
<definition name="installCFG" extends="pageTemplate">
<put-attribute name="body" value="/jsp/installCFG.jsp" type="page"/>
<put-attribute name="body" value="/jsp/installCFG.jsp"/>
<put-attribute name="title" value="INSTALL_CFG"/>
</definition>
@@ -56,15 +56,20 @@
<put-attribute name="details" value="NO_ENOUGH_PERMISSIONS_DETAILS"/>
</definition>
<definition name="emailNotExistsError" extends="errorTemplate">
<!-- Main Pages -->
<definition name="forgotPasswordError" extends="errorTemplate">
<put-attribute name="title" value="INVALID_EMAIL_ERROR"/>
<put-attribute name="body" value="/jsp/emailNotExistsError.jsp"/>
<put-attribute name="body" value="/jsp/userForgotPasswordError.jsp"/>
</definition>
<definition name="forgotPasswordSuccess" extends="errorTemplate">
<put-attribute name="title" value="FORGOT_PASSWORD"/>
<put-attribute name="body" value="/jsp/userForgotPasswordSuccess.jsp"/>
</definition>
<!-- Main Pages -->
<definition name="forgotPassword" extends="pageTemplate">
<put-attribute name="title" value="FORGOT_PASSWORD"/>
<put-attribute name="body" value="/jsp/forgotPassword.jsp"/>
<put-attribute name="body" value="/jsp/userForgotPassword.jsp"/>
</definition>
<definition name="userRegistration" extends="pageTemplate">

View File

@@ -28,7 +28,6 @@
<prop key="com.wisemapping.exceptions.UnsupportedBrowserException">browserNotSupported</prop>
<!-- Security exceptions are wrapped in this exceptions -->
<prop key="java.lang.reflect.UndeclaredThrowableException">securityError</prop>
<prop key="com.wisemapping.exceptions.EmailNotExistsException">emailNotExistsError</prop>
</props>
</property>
</bean>

View File

@@ -24,7 +24,7 @@
<sec:http pattern="/c/login" security="none"/>
<sec:http pattern="/c/userregistration" security="none"/>
<sec:http pattern="/c/forgotpassword" security="none"/>
<sec:http pattern="/c/user/resetpassword" security="none"/>
<sec:http pattern="/c/home" security="none"/>
<sec:http pattern="/c/maps/*/embed" security="none"/>

View File

@@ -1,78 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="mailer" class="com.wisemapping.mail.Mailer" singleton="true">
<constructor-arg index="0" value="${mail.registrationEmail}"/>
<constructor-arg index="1" value="${mail.siteEmail}"/>
<property name="mailSender" ref="mailSender"/>
<property name="velocityEngine" ref="velocityEngine"/>
</bean>
<bean id="userServiceTarget" class="com.wisemapping.service.UserServiceImpl">
<property name="userManager" ref="userManager"/>
<property name="mindmapService" ref="mindMapServiceTarget"/>
<property name="mailer" ref="mailer"/>
</bean>
<bean id="userService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"/>
<property name="target">
<ref local="userServiceTarget"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean id="mindMapServiceTarget" class="com.wisemapping.service.MindmapServiceImpl">
<property name="mindmapManager" ref="mindmapManager"/>
<property name="userService" ref="userService"/>
<property name="notificationService" ref="notificationService"/>
</bean>
<bean id="mindmapService"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces" value="com.wisemapping.service.MindmapService"/>
<property name="interceptorNames">
<list>
<value>txInterceptor</value>
<value>viewSecurityAdvisor</value>
<value>updateSecurityAdvisor</value>
</list>
</property>
<property name="target" ref="mindMapServiceTarget"/>
</bean>
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="${mail.smtp.host}"/>
<property name="port" value="${mail.smtp.port}"/>
<property name="protocol" value="smtp"/>
<property name="username" value="${mail.username}"/>
<property name="password" value="${mail.password}"/>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">${mail.smtp.auth}</prop>
<prop key="mail.smtp.starttls.enable">${mail.smtp.starttls.enable}</prop>
<prop key="mail.smtp.quitwait">${mail.smtp.quitwait}</prop>
</props>
</property>
</bean>
<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
<property name="velocityProperties">
<value>
resource.loader=class
class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
</value>
</property>
</bean>
<bean id="notificationService" class="com.wisemapping.mail.NotificationService" singleton="true">
<property name="baseUrl" value="${site.baseurl}"/>
<property name="mailer" ref="mailer"/>
</bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="mailer" class="com.wisemapping.mail.Mailer" singleton="true">
<constructor-arg index="0" value="${mail.serverSendEmail}"/>
<constructor-arg index="1" value="${mail.supportEmail}"/>
<property name="mailSender" ref="mailSender"/>
<property name="velocityEngine" ref="velocityEngine"/>
</bean>
<bean id="userServiceTarget" class="com.wisemapping.service.UserServiceImpl">
<property name="userManager" ref="userManager"/>
<property name="mindmapService" ref="mindMapServiceTarget"/>
<property name="notificationService" ref="notificationService"/>
</bean>
<bean id="userService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager"/>
<property name="target">
<ref local="userServiceTarget"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
<bean id="mindMapServiceTarget" class="com.wisemapping.service.MindmapServiceImpl">
<property name="mindmapManager" ref="mindmapManager"/>
<property name="userService" ref="userService"/>
<property name="notificationService" ref="notificationService"/>
</bean>
<bean id="mindmapService"
class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="proxyInterfaces" value="com.wisemapping.service.MindmapService"/>
<property name="interceptorNames">
<list>
<value>txInterceptor</value>
<value>viewSecurityAdvisor</value>
<value>updateSecurityAdvisor</value>
</list>
</property>
<property name="target" ref="mindMapServiceTarget"/>
</bean>
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="${mail.smtp.host}"/>
<property name="port" value="${mail.smtp.port}"/>
<property name="protocol" value="smtp"/>
<property name="username" value="${mail.username}"/>
<property name="password" value="${mail.password}"/>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">${mail.smtp.auth}</prop>
<prop key="mail.smtp.starttls.enable">${mail.smtp.starttls.enable}</prop>
<prop key="mail.smtp.quitwait">${mail.smtp.quitwait}</prop>
</props>
</property>
</bean>
<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
<property name="velocityProperties">
<value>
resource.loader=class
class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
</value>
</property>
</bean>
<bean id="notificationService" class="com.wisemapping.mail.NotificationService" singleton="true">
<property name="baseUrl" value="${site.baseurl}"/>
<property name="mailer" ref="mailer"/>
</bean>
</beans>

View File

@@ -51,18 +51,6 @@
<property name="captchaService" ref="reCaptcha"/>
</bean>
<bean id="forgotPasswordValidator" class="com.wisemapping.validator.ForgotPasswordValidator"/>
<bean id="forgotPasswordController" class="com.wisemapping.controller.ForgotPasswordController">
<property name="sessionForm" value="false"/>
<property name="commandName" value="forgotPassword"/>
<property name="commandClass" value="com.wisemapping.view.ForgotPasswordBean"/>
<property name="validator" ref="forgotPasswordValidator"/>
<property name="formView" value="forgotPassword"/>
<property name="successView" value="mindmap"/>
<property name="userService" ref="userService"/>
</bean>
<bean id="settingResolver" class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver">
<property name="mappings">
<props>
@@ -127,9 +115,8 @@
<property name="mappings">
<props>
<!-- Forms based -->
<prop key="userRegistration">userController</prop>
<prop key="userRegistration">usersController</prop>
<prop key="login">loginController</prop>
<prop key="forgotPassword">forgotPasswordController</prop>
<prop key="activation">activationController</prop>
<prop key="changePassword">changePasswordController</prop>
<prop key="settings">settingsController</prop>