- 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

@ -1,56 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.controller;
import com.wisemapping.exceptions.EmailNotExistsException;
import com.wisemapping.service.InvalidUserEmailException;
import com.wisemapping.service.UserService;
import com.wisemapping.view.ForgotPasswordBean;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;
import javax.servlet.ServletException;
public class ForgotPasswordController
extends BaseSimpleFormController
{
//~ Instance fields ......................................................................................
private UserService userService;
//~ Methods ..............................................................................................
public ModelAndView onSubmit(Object command)
throws ServletException, EmailNotExistsException {
final ForgotPasswordBean bean = (ForgotPasswordBean) command;
try {
userService.sendEmailPassword(bean.getEmail());
} catch (InvalidUserEmailException e) {
throw new EmailNotExistsException(e);
}
return new ModelAndView(new RedirectView(getSuccessView()));
}
public void setUserService(UserService userService)
{
this.userService = userService;
}
}

View File

@ -35,22 +35,18 @@ public final class Mailer {
private JavaMailSender mailSender; private JavaMailSender mailSender;
private VelocityEngine velocityEngine; private VelocityEngine velocityEngine;
private String registrationEmail; private String serverFromEmail;
private String siteEmail; private String supportEmail;
//~ Methods .............................................................................................. //~ Methods ..............................................................................................
public Mailer(String registrationEmail, String siteEmail) { public Mailer(@NotNull String siteEmail, @NotNull String supportEmail) {
this.registrationEmail = registrationEmail; this.serverFromEmail = siteEmail;
this.siteEmail = siteEmail; this.supportEmail = supportEmail;
} }
public String getRegistrationEmail() { public String getServerSenderEmail() {
return registrationEmail; return serverFromEmail;
}
public String getSiteEmail() {
return siteEmail;
} }
public void sendEmail(final String from, final String to, final String subject, final Map model, public void sendEmail(final String from, final String to, final String subject, final Map model,
@ -79,4 +75,8 @@ public final class Mailer {
public void setVelocityEngine(VelocityEngine engine) { public void setVelocityEngine(VelocityEngine engine) {
this.velocityEngine = engine; this.velocityEngine = engine;
} }
public String getSupportEmail() {
return supportEmail;
}
} }

View File

@ -43,7 +43,7 @@ final public class NotificationService {
try { try {
// Sent collaboration email ... // Sent collaboration email ...
final String formMail = mailer.getSiteEmail(); final String formMail = mailer.getServerSenderEmail();
// Is the user already registered user ?. // Is the user already registered user ?.
final String collabEmail = collaboration.getCollaborator().getEmail(); final String collabEmail = collaboration.getCollaborator().getEmail();
@ -69,6 +69,21 @@ final public class NotificationService {
} }
public void resetPassword(@NotNull User user, @NotNull String temporalPassword) {
try {
final Map<String, Object> model = new HashMap<String, Object>();
model.put("user", user);
model.put("temporalPassword", temporalPassword);
model.put("supportEmail", mailer.getSupportEmail());
model.put("password", temporalPassword);
model.put("baseUrl", this.baseUrl);
mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), "Reset Your WiseMapping Password", model, "passwordRecovery.vm");
} catch (Exception e) {
handleException(e);
}
}
private void handleException(Exception e) { private void handleException(Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -82,5 +97,20 @@ final public class NotificationService {
} }
public void activateAccount(@NotNull User user) {
final Map<String, User> model = new HashMap<String, User>();
model.put("user", user);
mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), "WiseMapping : Active account", model, "activationAccountMail.vm");
}
public void sendRegistrationEmail(@NotNull User user) {
final Map<String, Object> model = new HashMap<String, Object>();
model.put("user", user);
final String activationUrl = "http://wisemapping.com/c/activation?code=" + user.getActivationCode();
model.put("emailcheck", activationUrl);
mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), "Welcome to Wisemapping!", model,
"confirmationMail.vm");
}
} }

View File

@ -20,6 +20,7 @@ package com.wisemapping.ncontroller;
import com.wisemapping.service.MindmapService; import com.wisemapping.service.MindmapService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -27,6 +28,7 @@ import org.springframework.web.servlet.ModelAndView;
@Controller @Controller
public class PublicPagesController { public class PublicPagesController {
@Qualifier("mindmapService")
@Autowired @Autowired
private MindmapService mindmapService; private MindmapService mindmapService;
@ -57,8 +59,7 @@ public class PublicPagesController {
} }
@RequestMapping(value = "iframeWrapper") @RequestMapping(value = "iframeWrapper")
public ModelAndView showIframe(@RequestParam(required = true) String url) { public ModelAndView showIframe(@RequestParam(required = true) String url) {
return new ModelAndView("iframeWrapper", "url", url); return new ModelAndView("iframeWrapper", "url", url);
} }
} }

View File

@ -0,0 +1,65 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.ncontroller;
import com.wisemapping.service.InvalidUserEmailException;
import com.wisemapping.service.UserService;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class UsersController {
@Qualifier("userService")
@Autowired
private UserService userService;
@RequestMapping(value = "user/resetPassword", method = RequestMethod.GET)
public ModelAndView showResetPasswordPage() {
return new ModelAndView("forgotPassword");
}
@RequestMapping(value = "user/resetPassword", method = RequestMethod.POST)
public ModelAndView resetPassword(@RequestParam(required = true) String email) {
ModelAndView result;
try {
userService.resetPassword(email);
result = new ModelAndView("forgotPasswordSuccess");
} catch (InvalidUserEmailException e) {
result = new ModelAndView("forgotPasswordError");
}
return result;
}
public void setUserService(@NotNull UserService userService) {
this.userService = userService;
}
}

View File

@ -1,46 +1,46 @@
/* /*
* Copyright [2011] [wisemapping] * Copyright [2011] [wisemapping]
* *
* Licensed under WiseMapping Public License, Version 1.0 (the "License"). * Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the * It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page; * "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the license at * You may obtain a copy of the license at
* *
* http://www.wisemapping.org/license * http://www.wisemapping.org/license
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.wisemapping.service; package com.wisemapping.service;
import com.wisemapping.model.User; import com.wisemapping.model.User;
import com.wisemapping.exceptions.WiseMappingException; import com.wisemapping.exceptions.WiseMappingException;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public interface UserService { public interface UserService {
public void activateAccount(long code) throws InvalidActivationCodeException; public void activateAccount(long code) throws InvalidActivationCodeException;
public User createUser(@NotNull User user, boolean emailConfirmEnabled) throws WiseMappingException; public User createUser(@NotNull User user, boolean emailConfirmEnabled) throws WiseMappingException;
public void changePassword(User user); public void changePassword(@NotNull User user);
public User getUserBy(String email); public User getUserBy(String email);
public User getUserBy(long id); public User getUserBy(long id);
public User getUserByUsername(String username); public User getUserByUsername(String username);
public void updateUser(User user); public void updateUser(User user);
public void sendEmailPassword(String email) throws InvalidUserEmailException; public void resetPassword(@NotNull String email) throws InvalidUserEmailException;
public User reloadUser(final User user); public User reloadUser(final User user);
public void deleteUser(@NotNull User user); public void deleteUser(@NotNull User user);
} }

View File

@ -1,170 +1,157 @@
/* /*
* Copyright [2011] [wisemapping] * Copyright [2011] [wisemapping]
* *
* Licensed under WiseMapping Public License, Version 1.0 (the "License"). * Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the * It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page; * "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the license at * You may obtain a copy of the license at
* *
* http://www.wisemapping.org/license * http://www.wisemapping.org/license
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.wisemapping.service; package com.wisemapping.service;
import com.wisemapping.dao.UserManager; import com.wisemapping.dao.UserManager;
import com.wisemapping.exceptions.WiseMappingException; import com.wisemapping.exceptions.WiseMappingException;
import com.wisemapping.mail.Mailer; import com.wisemapping.mail.Mailer;
import com.wisemapping.model.Collaborator; import com.wisemapping.mail.NotificationService;
import com.wisemapping.model.User; import com.wisemapping.model.Collaborator;
import org.apache.log4j.Logger; import com.wisemapping.model.User;
import org.jetbrains.annotations.NotNull; import org.apache.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import java.util.Calendar;
import java.util.HashMap; import java.util.Calendar;
import java.util.Map; import java.util.HashMap;
import java.util.UUID; import java.util.Map;
import java.util.UUID;
public class UserServiceImpl
implements UserService { public class UserServiceImpl
private UserManager userManager; implements UserService {
private MindmapService mindmapService; private UserManager userManager;
private Mailer mailer; private MindmapService mindmapService;
final static Logger logger = Logger.getLogger("org.wisemapping.service"); private NotificationService notificationService;
public void activateAccount(long code) public void activateAccount(long code)
throws InvalidActivationCodeException { throws InvalidActivationCodeException {
final User user = userManager.getUserByActivationCode(code); final User user = userManager.getUserByActivationCode(code);
if (user == null || user.isActive()) { if (user == null || user.isActive()) {
throw new InvalidActivationCodeException("Invalid Activation Code"); throw new InvalidActivationCodeException("Invalid Activation Code");
} else { } else {
final Calendar now = Calendar.getInstance(); final Calendar now = Calendar.getInstance();
user.setActivationDate(now); user.setActivationDate(now);
userManager.updateUser(user); userManager.updateUser(user);
final Map<String, User> model = new HashMap<String, User>(); notificationService.activateAccount(user);
model.put("user", user); }
mailer.sendEmail(mailer.getRegistrationEmail(), user.getEmail(), "WiseMapping : Active account", model, "activationAccountMail.vm"); }
}
} public User reloadUser(final User user) {
return this.getUserBy(user.getId());
public User reloadUser(final User user) { }
return this.getUserBy(user.getId());
} public void resetPassword(@NotNull String email)
throws InvalidUserEmailException {
public void sendEmailPassword(String email) final User user = userManager.getUserBy(email);
throws InvalidUserEmailException { if (user != null) {
final User user = userManager.getUserBy(email); // Generate a random password ...
if (user != null) { final String password = randomstring(8, 10);
final Map<String, Object> model = new HashMap<String, Object>(); user.setPassword(password);
final String password = randomstring(8, 10); changePassword(user);
user.setPassword(password);
changePassword(user); // Send an email with the new temporal password ...
model.put("user", user); notificationService.resetPassword(user, password);
model.put("password", password);
mailer.sendEmail(mailer.getRegistrationEmail(), user.getEmail(), "WiseMapping : Recovery Password", model, "passwordRecovery.vm"); } else {
} else { throw new InvalidUserEmailException("The email '" + email + "' does not exists.");
throw new InvalidUserEmailException("The email '" + email + "' does not exists."); }
} }
}
private String randomstring(int lo, int hi) {
private String randomstring(int lo, int hi) { int n = rand(lo, hi);
int n = rand(lo, hi); byte b[] = new byte[n];
byte b[] = new byte[n]; for (int i = 0; i < n; i++)
for (int i = 0; i < n; i++) b[i] = (byte) rand('@', 'Z');
b[i] = (byte) rand('@', 'Z'); return new String(b);
return new String(b); }
}
private int rand(int lo, int hi) {
private int rand(int lo, int hi) { java.util.Random rn = new java.util.Random();
java.util.Random rn = new java.util.Random(); int n = hi - lo + 1;
int n = hi - lo + 1; int i = rn.nextInt() % n;
int i = rn.nextInt() % n; if (i < 0)
if (i < 0) i = -i;
i = -i; return lo + i;
return lo + i; }
}
public void deleteUser(@NotNull User user) {
public void deleteUser(@NotNull User user){ userManager.deleteUser(user);
userManager.deleteUser(user); }
}
public User createUser(@NotNull User user, boolean emailConfirmEnabled) throws WiseMappingException {
public User createUser(@NotNull User user, boolean emailConfirmEnabled) throws WiseMappingException { final UUID uuid = UUID.randomUUID();
final UUID uuid = UUID.randomUUID(); user.setCreationDate(Calendar.getInstance());
user.setCreationDate(Calendar.getInstance()); user.setActivationCode(uuid.getLeastSignificantBits());
user.setActivationCode(uuid.getLeastSignificantBits());
if (emailConfirmEnabled) {
if (emailConfirmEnabled) { user.setActivationDate(null);
user.setActivationDate(null);
} else {
} else { user.setActivationDate(Calendar.getInstance());
user.setActivationDate(Calendar.getInstance()); }
}
Collaborator col = userManager.getCollaboratorBy(user.getEmail());
Collaborator col = userManager.getCollaboratorBy(user.getEmail()); if (col != null) {
if (col != null) { userManager.createUser(user, col);
userManager.createUser(user, col); } else {
} else { userManager.createUser(user);
userManager.createUser(user); }
}
//create welcome map
//create welcome map mindmapService.addWelcomeMindmap(user);
mindmapService.addWelcomeMindmap(user);
// Send registration email.
// Send registration email. if (emailConfirmEnabled) {
if (emailConfirmEnabled) { notificationService.sendRegistrationEmail(user);
sendRegistrationEmail(user); }
} return user;
return user; }
}
public void changePassword(@NotNull User user) {
private void sendRegistrationEmail(User user) { userManager.updateUser(user);
final Map<String, Object> model = new HashMap<String, Object>(); }
model.put("user", user);
public User getUserBy(String email) {
return userManager.getUserBy(email);
final String activationUrl = "http://wisemapping.com/c/activation?code=" + user.getActivationCode(); }
logger.info("create User - acrivationUrl: " + activationUrl);
model.put("emailcheck", activationUrl); public User getUserByUsername(String username) {
mailer.sendEmail(mailer.getRegistrationEmail(), user.getEmail(), "Welcome to Wisemapping!", model, return userManager.getUserByUsername(username);
"confirmationMail.vm"); }
}
public User getUserBy(long id) {
public void changePassword(User user) { return userManager.getUserBy(id);
userManager.updateUser(user); }
}
public void updateUser(@NotNull User user) {
public User getUserBy(String email) { userManager.updateUser(user);
return userManager.getUserBy(email); }
}
public void setUserManager(@NotNull UserManager userManager) {
public User getUserByUsername(String username) { this.userManager = userManager;
return userManager.getUserByUsername(username); }
}
public void setMindmapService(@NotNull MindmapService mindmapService) {
public User getUserBy(long id) { this.mindmapService = mindmapService;
return userManager.getUserBy(id); }
}
public void setNotificationService(NotificationService notificationService) {
public void updateUser(User user) { this.notificationService = notificationService;
userManager.updateUser(user); }
} }
public void setUserManager(UserManager userManager) {
this.userManager = userManager;
}
public void setMailer(Mailer mailer) {
this.mailer = mailer;
}
public void setMindmapService(MindmapService mindmapService) {
this.mindmapService = mindmapService;
}
}

View File

@ -1,47 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.validator;
import org.springframework.validation.Validator;
import org.springframework.validation.Errors;
import com.wisemapping.view.ForgotPasswordBean;
import com.wisemapping.controller.Messages;
public class ForgotPasswordValidator
implements Validator {
public boolean supports(final Class clazz) {
return clazz.equals(ForgotPasswordBean.class);
}
public void validate(Object obj, Errors errors) {
ForgotPasswordBean bean = (ForgotPasswordBean) obj;
if (bean == null) {
errors.rejectValue("forgotPassword", "error.not-specified", null, "Value required.");
} else {
final String email = bean.getEmail();
boolean isValid = Utils.isValidateEmailAddress(email);
if (!isValid) {
errors.rejectValue("email", Messages.NO_VALID_EMAIL_ADDRESS);
}
}
}
}

View File

@ -1,32 +0,0 @@
/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.view;
public class ForgotPasswordBean {
private String email;
public String getEmail() {
return email;
}
public void setEmail(String e) {
this.email = e;
}
}

View File

@ -34,17 +34,21 @@ database.password=
#------------------------ #------------------------
mail.smtp.port=587 mail.smtp.port=587
mail.smtp.host=smtp.gmail.com mail.smtp.host=smtp.gmail.com
mail.username=pveiga@gmail.com mail.username=<gmail-user-account>
mail.password= mail.password=<gmail-password>
mail.smtp.auth=true mail.smtp.auth=true
mail.smtp.starttls.enable=true mail.smtp.starttls.enable=true
mail.smtp.quitwait=false 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 # Users Registration Configuration

View File

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

View File

@ -1,24 +1,37 @@
<html> <html>
<body> <body>
<h3>Your password was regenerated from WiseMapping!</h3> <div style="background-color: #fbeed5; max-width: 650px; font-family: Arial, sans-serif; color: #000; padding: 5px;">
<p> <div style="height: 60px; font-size: 14px; font-weight: bold; padding-bottom: 4px;">
Your account information is: <table style="display: inline;width: 100%;">
</p> <tbody>
User Login: ${user.email} <tr>
</p> <td height="50px" width="2px"
<p> style="padding: 0; padding-right: 5px; text-align:center;font-weight: normal;font-family: Arial, sans-serif">
New Password: ${password} <a href="${baseUrl}">
</p> <img style="border: 0;margin-top: 10px;"
<p> src="${baseUrl}/images/logo-small.png"
Thank you for using WiseMapping. alt="WiseMapping Log"/>
</p>
<p> </a>
For questions or concerns regarding your account, send us an email to support@wisemapping.com. </td>
</p> <td valign="bottom" height="32px" style="padding: 0;font-size: 16px;">
<p> Your password has been reset
Best Regards, <br/> </td>
The WiseMapping Team. </tr>
<a href="http://www.wisemapping.com">WiseMapping Site</a> </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> </p>
</body> </body>
</html> </html>

View File

@ -90,7 +90,7 @@ CREW=The Crew
ALREADY_A_MEMBER=Already a member? ALREADY_A_MEMBER=Already a member?
WORD_VERIFICATION=Word Verification WORD_VERIFICATION=Word Verification
TERM_OF_THE_SERVICE=Terms of Service: 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 SEARCH_FIELD=Map Title or Tag
FIELD_REQUIRED=Required field cannot be left blank FIELD_REQUIRED=Required field cannot be left blank

View File

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

View File

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

View File

@ -24,7 +24,7 @@
<sec:http pattern="/c/login" security="none"/> <sec:http pattern="/c/login" security="none"/>
<sec:http pattern="/c/userregistration" 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/home" security="none"/>
<sec:http pattern="/c/maps/*/embed" security="none"/> <sec:http pattern="/c/maps/*/embed" security="none"/>

View File

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

View File

@ -51,18 +51,6 @@
<property name="captchaService" ref="reCaptcha"/> <property name="captchaService" ref="reCaptcha"/>
</bean> </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"> <bean id="settingResolver" class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver">
<property name="mappings"> <property name="mappings">
<props> <props>
@ -127,9 +115,8 @@
<property name="mappings"> <property name="mappings">
<props> <props>
<!-- Forms based --> <!-- Forms based -->
<prop key="userRegistration">userController</prop> <prop key="userRegistration">usersController</prop>
<prop key="login">loginController</prop> <prop key="login">loginController</prop>
<prop key="forgotPassword">forgotPasswordController</prop>
<prop key="activation">activationController</prop> <prop key="activation">activationController</prop>
<prop key="changePassword">changePasswordController</prop> <prop key="changePassword">changePasswordController</prop>
<prop key="settings">settingsController</prop> <prop key="settings">settingsController</prop>

View File

@ -1,13 +0,0 @@
<%@ include file="/jsp/init.jsp" %>
<h1>
<spring:message code="INVALID_EMAIL_ERROR"/>
</h1>
<h2>The email is not register or you account is not active yet.</h2>
<p>If the problem persist please send us an email to <a href="mailto:support@wisemapping.com">support@wisemapping.com </a></p>
</br>
<p>We are working to add more features in the future. Stay tuned !</p>
</br>
<p>Best Regards,</p>
<p>WiseMapping Team.</p>

View File

@ -1,10 +1,6 @@
<%@ page import="org.apache.log4j.Logger" %>
<%@ page autoFlush="true" buffer="none" %> <%@ page autoFlush="true" buffer="none" %>
<%@ include file="/jsp/init.jsp" %> <%@ include file="/jsp/init.jsp" %>
<%!
final Logger logger = Logger.getLogger("com.wisemapping");
%>
<div style="position:relative;"> <div style="position:relative;">
<div id="prompt"> <div id="prompt">
<!-- if IE without GCF, prompt goes here --> <!-- if IE without GCF, prompt goes here -->

View File

@ -15,7 +15,7 @@
<div class="loginNews"> <div class="loginNews">
<h1>What is New: </h1> <h1>What is New: </h1>
<ul> <ul>
<li>Links Between Nodes</li> <li>Complerly new UI</li>
<li>FreeMind 0.9 Update</li> <li>FreeMind 0.9 Update</li>
<li>Improved HTML 5.0 Support</li> <li>Improved HTML 5.0 Support</li>
<li>Firefox 12 officially supported</li> <li>Firefox 12 officially supported</li>

View File

@ -1,33 +1,39 @@
<%@ include file="/jsp/init.jsp" %> <%@ include file="/jsp/init.jsp" %>
<script type="text/javascript" language="javascript">
$(function() {
<div> $('.btn-primary').click(function() {
<div class="fform"> $(this).button("loading");
<h1> });
<spring:message code="FORGOT_PASSWORD"/> });
</h1> </script>
<p><spring:message code="FORGOT_PASSWORD_MESSAGE"/></p>
<div>
<form:form method="post" commandName="forgotPassword"> <div class="fform">
<fieldset> <h1>
<label for="email"><spring:message code="EMAIL"/></label> <spring:message code="FORGOT_PASSWORD"/>
<form:input path="email" id="email" tabindex="1" type="email" required="required"/> </h1>
<form:errors path="email" cssClass="errorMsg"/>
<p><spring:message code="FORGOT_PASSWORD_MESSAGE"/></p>
<input type="submit" value="<spring:message code="SUBMIT"/>" class="btn btn-primary"/>
<input type="button" value="<spring:message code="CANCEL"/>" class="btn" <form:form method="post" commandName="resetPassword">
onclick="window.location='<c:url value="c/maps/"/>'"/> <fieldset>
</fieldset> <label for="email"><spring:message code="EMAIL"/></label>
</form:form> <input id="email" type="email" required="required" name="email"/>
</div>
</div> <input type="submit" value="<spring:message code="SUBMIT"/>" class="btn btn-primary" data-loading-text="Saving ..."/>
<input type="button" value="<spring:message code="CANCEL"/>" class="btn"
<div id="register"> onclick="window.location='<c:url value="c/maps/"/>'"/>
<b> </fieldset>
<spring:message code="NOT_READY_A_USER"/> </form:form>
</b> </div>
<spring:message code="NOT_READY_A_USER_MESSAGE"/> </div>
<a href="userRegistration">
<spring:message code="JOIN_NOW"/> <div id="register">
</a> <b>
<spring:message code="NOT_READY_A_USER"/>
</b>
<spring:message code="NOT_READY_A_USER_MESSAGE"/>
<a href="c/userRegistration">
<spring:message code="JOIN_NOW"/>
</a>
</div> </div>

View File

@ -0,0 +1,6 @@
<%@ include file="/jsp/init.jsp" %>
<h2>The email is not register or you account is not active yet.</h2>
<p>If the problem persist please send us an email to <a
href="mailto:support@wisemapping.com">support@wisemapping.com </a></p>

View File

@ -0,0 +1,12 @@
<%@ include file="/jsp/init.jsp" %>
<h2>
Your temporal password has been sent
</h2>
<p>
We've sent you an email that will allow you to reset your password quickly and easily. Please check your email now.
</p>
<p>If you have any problem receiving the email, contact us to <a
href="mailto:support@wisemapping.com">support@wisemapping.com </a></p>