From 7d6b82c626d587fb0c6edcce3fd862f1c41df593 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sat, 16 Jun 2012 15:59:59 -0300 Subject: [PATCH] - Fix forgot password email - Rewrite forgot password to use the new MVC model. - Show a dialog when the password has been sent. --- .../controller/ForgotPasswordController.java | 56 --- .../java/com/wisemapping/mail/Mailer.java | 22 +- .../wisemapping/mail/NotificationService.java | 32 +- .../ncontroller/PublicPagesController.java | 9 +- .../ncontroller/UsersController.java | 65 ++++ .../com/wisemapping/service/UserService.java | 92 ++--- .../wisemapping/service/UserServiceImpl.java | 327 +++++++++--------- .../validator/ForgotPasswordValidator.java | 47 --- .../wisemapping/view/ForgotPasswordBean.java | 32 -- .../src/main/webapp/WEB-INF/app.properties | 14 +- .../webapp/WEB-INF/classes/log4j.properties | 46 +-- .../WEB-INF/classes/mail/passwordRecovery.vm | 51 ++- .../WEB-INF/classes/messages.properties | 2 +- .../main/webapp/WEB-INF/defs/definitions.xml | 25 +- .../webapp/WEB-INF/wisemapping-nservlet.xml | 1 - .../webapp/WEB-INF/wisemapping-security.xml | 2 +- .../webapp/WEB-INF/wisemapping-service.xml | 156 ++++----- .../webapp/WEB-INF/wisemapping-servlet.xml | 15 +- .../main/webapp/jsp/emailNotExistsError.jsp | 13 - .../src/main/webapp/jsp/installCFG.jsp | 4 - wise-webapp/src/main/webapp/jsp/login.jsp | 2 +- ...gotPassword.jsp => userForgotPassword.jsp} | 70 ++-- .../webapp/jsp/userForgotPasswordError.jsp | 6 + .../webapp/jsp/userForgotPasswordSuccess.jsp | 12 + ...mation.jsp => userRegistrationSuccess.jsp} | 0 25 files changed, 532 insertions(+), 569 deletions(-) delete mode 100755 wise-webapp/src/main/java/com/wisemapping/controller/ForgotPasswordController.java create mode 100644 wise-webapp/src/main/java/com/wisemapping/ncontroller/UsersController.java delete mode 100755 wise-webapp/src/main/java/com/wisemapping/validator/ForgotPasswordValidator.java delete mode 100755 wise-webapp/src/main/java/com/wisemapping/view/ForgotPasswordBean.java delete mode 100755 wise-webapp/src/main/webapp/jsp/emailNotExistsError.jsp rename wise-webapp/src/main/webapp/jsp/{forgotPassword.jsp => userForgotPassword.jsp} (64%) create mode 100755 wise-webapp/src/main/webapp/jsp/userForgotPasswordError.jsp create mode 100644 wise-webapp/src/main/webapp/jsp/userForgotPasswordSuccess.jsp rename wise-webapp/src/main/webapp/jsp/{userRegistrationConfirmation.jsp => userRegistrationSuccess.jsp} (100%) diff --git a/wise-webapp/src/main/java/com/wisemapping/controller/ForgotPasswordController.java b/wise-webapp/src/main/java/com/wisemapping/controller/ForgotPasswordController.java deleted file mode 100755 index 8e7cc89e..00000000 --- a/wise-webapp/src/main/java/com/wisemapping/controller/ForgotPasswordController.java +++ /dev/null @@ -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; - } -} diff --git a/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java b/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java index 48dcd3c8..ab7c9083 100644 --- a/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java +++ b/wise-webapp/src/main/java/com/wisemapping/mail/Mailer.java @@ -35,22 +35,18 @@ public final class Mailer { private JavaMailSender mailSender; private VelocityEngine velocityEngine; - private String registrationEmail; - private String siteEmail; + private String serverFromEmail; + private String supportEmail; //~ Methods .............................................................................................. - public Mailer(String registrationEmail, String siteEmail) { - this.registrationEmail = registrationEmail; - this.siteEmail = siteEmail; + public Mailer(@NotNull String siteEmail, @NotNull String supportEmail) { + this.serverFromEmail = siteEmail; + this.supportEmail = supportEmail; } - public String getRegistrationEmail() { - return registrationEmail; - } - - public String getSiteEmail() { - return siteEmail; + public String getServerSenderEmail() { + return serverFromEmail; } 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) { this.velocityEngine = engine; } + + public String getSupportEmail() { + return supportEmail; + } } diff --git a/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java b/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java index 6cbf012b..68bd41e5 100644 --- a/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java +++ b/wise-webapp/src/main/java/com/wisemapping/mail/NotificationService.java @@ -43,7 +43,7 @@ final public class NotificationService { try { // Sent collaboration email ... - final String formMail = mailer.getSiteEmail(); + final String formMail = mailer.getServerSenderEmail(); // Is the user already registered user ?. 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 model = new HashMap(); + 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) { e.printStackTrace(); } @@ -82,5 +97,20 @@ final public class NotificationService { } + public void activateAccount(@NotNull User user) { + final Map model = new HashMap(); + model.put("user", user); + mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), "WiseMapping : Active account", model, "activationAccountMail.vm"); + } + + public void sendRegistrationEmail(@NotNull User user) { + final Map model = new HashMap(); + 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"); + } } + diff --git a/wise-webapp/src/main/java/com/wisemapping/ncontroller/PublicPagesController.java b/wise-webapp/src/main/java/com/wisemapping/ncontroller/PublicPagesController.java index e207d1ef..3e67e690 100644 --- a/wise-webapp/src/main/java/com/wisemapping/ncontroller/PublicPagesController.java +++ b/wise-webapp/src/main/java/com/wisemapping/ncontroller/PublicPagesController.java @@ -20,6 +20,7 @@ package com.wisemapping.ncontroller; import com.wisemapping.service.MindmapService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -27,6 +28,7 @@ import org.springframework.web.servlet.ModelAndView; @Controller public class PublicPagesController { + @Qualifier("mindmapService") @Autowired private MindmapService mindmapService; @@ -57,8 +59,7 @@ public class PublicPagesController { } @RequestMapping(value = "iframeWrapper") - public ModelAndView showIframe(@RequestParam(required = true) String url) { - return new ModelAndView("iframeWrapper", "url", url); - } - + public ModelAndView showIframe(@RequestParam(required = true) String url) { + return new ModelAndView("iframeWrapper", "url", url); + } } diff --git a/wise-webapp/src/main/java/com/wisemapping/ncontroller/UsersController.java b/wise-webapp/src/main/java/com/wisemapping/ncontroller/UsersController.java new file mode 100644 index 00000000..9f2d76d0 --- /dev/null +++ b/wise-webapp/src/main/java/com/wisemapping/ncontroller/UsersController.java @@ -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; + } +} diff --git a/wise-webapp/src/main/java/com/wisemapping/service/UserService.java b/wise-webapp/src/main/java/com/wisemapping/service/UserService.java index ff06cd5d..199d28a2 100755 --- a/wise-webapp/src/main/java/com/wisemapping/service/UserService.java +++ b/wise-webapp/src/main/java/com/wisemapping/service/UserService.java @@ -1,46 +1,46 @@ -/* -* 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.service; - -import com.wisemapping.model.User; -import com.wisemapping.exceptions.WiseMappingException; -import org.jetbrains.annotations.NotNull; - -public interface UserService { - - public void activateAccount(long code) throws InvalidActivationCodeException; - - public User createUser(@NotNull User user, boolean emailConfirmEnabled) throws WiseMappingException; - - public void changePassword(User user); - - public User getUserBy(String email); - - public User getUserBy(long id); - - public User getUserByUsername(String username); - - public void updateUser(User user); - - public void sendEmailPassword(String email) throws InvalidUserEmailException; - - public User reloadUser(final User user); - - public void deleteUser(@NotNull User user); -} +/* +* 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.service; + +import com.wisemapping.model.User; +import com.wisemapping.exceptions.WiseMappingException; +import org.jetbrains.annotations.NotNull; + +public interface UserService { + + public void activateAccount(long code) throws InvalidActivationCodeException; + + public User createUser(@NotNull User user, boolean emailConfirmEnabled) throws WiseMappingException; + + public void changePassword(@NotNull User user); + + public User getUserBy(String email); + + public User getUserBy(long id); + + public User getUserByUsername(String username); + + public void updateUser(User user); + + public void resetPassword(@NotNull String email) throws InvalidUserEmailException; + + public User reloadUser(final User user); + + public void deleteUser(@NotNull User user); +} diff --git a/wise-webapp/src/main/java/com/wisemapping/service/UserServiceImpl.java b/wise-webapp/src/main/java/com/wisemapping/service/UserServiceImpl.java index 6fe708d9..7ce0779f 100755 --- a/wise-webapp/src/main/java/com/wisemapping/service/UserServiceImpl.java +++ b/wise-webapp/src/main/java/com/wisemapping/service/UserServiceImpl.java @@ -1,170 +1,157 @@ -/* -* 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.service; - -import com.wisemapping.dao.UserManager; -import com.wisemapping.exceptions.WiseMappingException; -import com.wisemapping.mail.Mailer; -import com.wisemapping.model.Collaborator; -import com.wisemapping.model.User; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; - -import java.util.Calendar; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -public class UserServiceImpl - implements UserService { - private UserManager userManager; - private MindmapService mindmapService; - private Mailer mailer; - final static Logger logger = Logger.getLogger("org.wisemapping.service"); - - public void activateAccount(long code) - throws InvalidActivationCodeException { - final User user = userManager.getUserByActivationCode(code); - if (user == null || user.isActive()) { - throw new InvalidActivationCodeException("Invalid Activation Code"); - } else { - final Calendar now = Calendar.getInstance(); - user.setActivationDate(now); - userManager.updateUser(user); - final Map model = new HashMap(); - 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 void sendEmailPassword(String email) - throws InvalidUserEmailException { - final User user = userManager.getUserBy(email); - if (user != null) { - final Map model = new HashMap(); - final String password = randomstring(8, 10); - user.setPassword(password); - changePassword(user); - model.put("user", user); - model.put("password", password); - - mailer.sendEmail(mailer.getRegistrationEmail(), user.getEmail(), "WiseMapping : Recovery Password", model, "passwordRecovery.vm"); - } else { - throw new InvalidUserEmailException("The email '" + email + "' does not exists."); - } - } - - private String randomstring(int lo, int hi) { - int n = rand(lo, hi); - byte b[] = new byte[n]; - for (int i = 0; i < n; i++) - b[i] = (byte) rand('@', 'Z'); - return new String(b); - } - - private int rand(int lo, int hi) { - java.util.Random rn = new java.util.Random(); - int n = hi - lo + 1; - int i = rn.nextInt() % n; - if (i < 0) - i = -i; - return lo + i; - } - - public void deleteUser(@NotNull User user){ - userManager.deleteUser(user); - } - - public User createUser(@NotNull User user, boolean emailConfirmEnabled) throws WiseMappingException { - final UUID uuid = UUID.randomUUID(); - user.setCreationDate(Calendar.getInstance()); - user.setActivationCode(uuid.getLeastSignificantBits()); - - if (emailConfirmEnabled) { - user.setActivationDate(null); - - } else { - user.setActivationDate(Calendar.getInstance()); - } - - Collaborator col = userManager.getCollaboratorBy(user.getEmail()); - if (col != null) { - userManager.createUser(user, col); - } else { - userManager.createUser(user); - } - - //create welcome map - mindmapService.addWelcomeMindmap(user); - - // Send registration email. - if (emailConfirmEnabled) { - sendRegistrationEmail(user); - } - return user; - } - - private void sendRegistrationEmail(User user) { - final Map model = new HashMap(); - model.put("user", user); - - - final String activationUrl = "http://wisemapping.com/c/activation?code=" + user.getActivationCode(); - logger.info("create User - acrivationUrl: " + activationUrl); - model.put("emailcheck", activationUrl); - mailer.sendEmail(mailer.getRegistrationEmail(), user.getEmail(), "Welcome to Wisemapping!", model, - "confirmationMail.vm"); - } - - public void changePassword(User user) { - userManager.updateUser(user); - } - - public User getUserBy(String email) { - return userManager.getUserBy(email); - } - - public User getUserByUsername(String username) { - return userManager.getUserByUsername(username); - } - - public User getUserBy(long id) { - return userManager.getUserBy(id); - } - - public void updateUser(User user) { - 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; - } -} +/* +* 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.service; + +import com.wisemapping.dao.UserManager; +import com.wisemapping.exceptions.WiseMappingException; +import com.wisemapping.mail.Mailer; +import com.wisemapping.mail.NotificationService; +import com.wisemapping.model.Collaborator; +import com.wisemapping.model.User; +import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; + +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +public class UserServiceImpl + implements UserService { + private UserManager userManager; + private MindmapService mindmapService; + private NotificationService notificationService; + + public void activateAccount(long code) + throws InvalidActivationCodeException { + final User user = userManager.getUserByActivationCode(code); + if (user == null || user.isActive()) { + throw new InvalidActivationCodeException("Invalid Activation Code"); + } else { + final Calendar now = Calendar.getInstance(); + user.setActivationDate(now); + userManager.updateUser(user); + notificationService.activateAccount(user); + } + } + + public User reloadUser(final User user) { + return this.getUserBy(user.getId()); + } + + public void resetPassword(@NotNull String email) + throws InvalidUserEmailException { + final User user = userManager.getUserBy(email); + if (user != null) { + // Generate a random password ... + final String password = randomstring(8, 10); + user.setPassword(password); + changePassword(user); + + // Send an email with the new temporal password ... + notificationService.resetPassword(user, password); + + + } else { + throw new InvalidUserEmailException("The email '" + email + "' does not exists."); + } + } + + private String randomstring(int lo, int hi) { + int n = rand(lo, hi); + byte b[] = new byte[n]; + for (int i = 0; i < n; i++) + b[i] = (byte) rand('@', 'Z'); + return new String(b); + } + + private int rand(int lo, int hi) { + java.util.Random rn = new java.util.Random(); + int n = hi - lo + 1; + int i = rn.nextInt() % n; + if (i < 0) + i = -i; + return lo + i; + } + + public void deleteUser(@NotNull User user) { + userManager.deleteUser(user); + } + + public User createUser(@NotNull User user, boolean emailConfirmEnabled) throws WiseMappingException { + final UUID uuid = UUID.randomUUID(); + user.setCreationDate(Calendar.getInstance()); + user.setActivationCode(uuid.getLeastSignificantBits()); + + if (emailConfirmEnabled) { + user.setActivationDate(null); + + } else { + user.setActivationDate(Calendar.getInstance()); + } + + Collaborator col = userManager.getCollaboratorBy(user.getEmail()); + if (col != null) { + userManager.createUser(user, col); + } else { + userManager.createUser(user); + } + + //create welcome map + mindmapService.addWelcomeMindmap(user); + + // Send registration email. + if (emailConfirmEnabled) { + notificationService.sendRegistrationEmail(user); + } + return user; + } + + public void changePassword(@NotNull User user) { + userManager.updateUser(user); + } + + public User getUserBy(String email) { + return userManager.getUserBy(email); + } + + public User getUserByUsername(String username) { + return userManager.getUserByUsername(username); + } + + public User getUserBy(long id) { + return userManager.getUserBy(id); + } + + public void updateUser(@NotNull User user) { + userManager.updateUser(user); + } + + public void setUserManager(@NotNull UserManager userManager) { + this.userManager = userManager; + } + + public void setMindmapService(@NotNull MindmapService mindmapService) { + this.mindmapService = mindmapService; + } + + public void setNotificationService(NotificationService notificationService) { + this.notificationService = notificationService; + } +} diff --git a/wise-webapp/src/main/java/com/wisemapping/validator/ForgotPasswordValidator.java b/wise-webapp/src/main/java/com/wisemapping/validator/ForgotPasswordValidator.java deleted file mode 100755 index 3c874fc7..00000000 --- a/wise-webapp/src/main/java/com/wisemapping/validator/ForgotPasswordValidator.java +++ /dev/null @@ -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); - } - } - } -} diff --git a/wise-webapp/src/main/java/com/wisemapping/view/ForgotPasswordBean.java b/wise-webapp/src/main/java/com/wisemapping/view/ForgotPasswordBean.java deleted file mode 100755 index 8b3ac600..00000000 --- a/wise-webapp/src/main/java/com/wisemapping/view/ForgotPasswordBean.java +++ /dev/null @@ -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; - } -} diff --git a/wise-webapp/src/main/webapp/WEB-INF/app.properties b/wise-webapp/src/main/webapp/WEB-INF/app.properties index 16257303..10477130 100755 --- a/wise-webapp/src/main/webapp/WEB-INF/app.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/app.properties @@ -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= +mail.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 diff --git a/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties b/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties index e415a7a2..20c65b45 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/classes/log4j.properties @@ -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 � -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 � -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 � +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 � +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 diff --git a/wise-webapp/src/main/webapp/WEB-INF/classes/mail/passwordRecovery.vm b/wise-webapp/src/main/webapp/WEB-INF/classes/mail/passwordRecovery.vm index fa8c97a0..ae9028f7 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/classes/mail/passwordRecovery.vm +++ b/wise-webapp/src/main/webapp/WEB-INF/classes/mail/passwordRecovery.vm @@ -1,24 +1,37 @@ -

Your password was regenerated from WiseMapping!

-

- Your account information is: -

- User Login: ${user.email} -

-

- New Password: ${password} -

-

- Thank you for using WiseMapping. -

-

- For questions or concerns regarding your account, send us an email to support@wisemapping.com. -

-

-Best Regards,
-The WiseMapping Team. -WiseMapping Site +

+
+ + + + + + + +
+ + WiseMapping Log + + + + Your password has been reset +
+
+
+

A temporal password has been generated for you account.

+ +

New Password: ${password}

+ +

You can login clicking here.We strongly encourage you to change the password as soon as possible.

+
+
+ +

Important: Do not reply this email. If + you need further help or have any concerns regarding your account, contact us to here.

\ No newline at end of file diff --git a/wise-webapp/src/main/webapp/WEB-INF/classes/messages.properties b/wise-webapp/src/main/webapp/WEB-INF/classes/messages.properties index 801b2e13..c8d64b42 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/classes/messages.properties +++ b/wise-webapp/src/main/webapp/WEB-INF/classes/messages.properties @@ -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 diff --git a/wise-webapp/src/main/webapp/WEB-INF/defs/definitions.xml b/wise-webapp/src/main/webapp/WEB-INF/defs/definitions.xml index d4aa1e44..1cd30f49 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/defs/definitions.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/defs/definitions.xml @@ -1,6 +1,6 @@ - + @@ -30,19 +30,19 @@ - + - + - + @@ -56,15 +56,20 @@ - + + - + + + + + + - - + diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-nservlet.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-nservlet.xml index 91af3751..aa6b4c80 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-nservlet.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-nservlet.xml @@ -28,7 +28,6 @@ browserNotSupported securityError - emailNotExistsError diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml index cdb4515b..a0fa10bf 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-security.xml @@ -24,7 +24,7 @@ - + diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml index 337284ff..538ae925 100755 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-service.xml @@ -1,78 +1,78 @@ - - - - - - - - - - - - - - - - - - - - - - - - - PROPAGATION_REQUIRED - - - - - - - - - - - - - - - txInterceptor - viewSecurityAdvisor - updateSecurityAdvisor - - - - - - - - - - - - - - ${mail.smtp.auth} - ${mail.smtp.starttls.enable} - ${mail.smtp.quitwait} - - - - - - - - resource.loader=class - class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + PROPAGATION_REQUIRED + + + + + + + + + + + + + + + txInterceptor + viewSecurityAdvisor + updateSecurityAdvisor + + + + + + + + + + + + + + ${mail.smtp.auth} + ${mail.smtp.starttls.enable} + ${mail.smtp.quitwait} + + + + + + + + resource.loader=class + class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader + + + + + + + + + + diff --git a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml index 734d380d..6e5d2349 100644 --- a/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml +++ b/wise-webapp/src/main/webapp/WEB-INF/wisemapping-servlet.xml @@ -51,18 +51,6 @@ - - - - - - - - - - - - @@ -127,9 +115,8 @@ - userController + usersController loginController - forgotPasswordController activationController changePasswordController settingsController diff --git a/wise-webapp/src/main/webapp/jsp/emailNotExistsError.jsp b/wise-webapp/src/main/webapp/jsp/emailNotExistsError.jsp deleted file mode 100755 index 10c6dd32..00000000 --- a/wise-webapp/src/main/webapp/jsp/emailNotExistsError.jsp +++ /dev/null @@ -1,13 +0,0 @@ -<%@ include file="/jsp/init.jsp" %> -

- -

- -

The email is not register or you account is not active yet.

- -

If the problem persist please send us an email to support@wisemapping.com

-
-

We are working to add more features in the future. Stay tuned !

-
-

Best Regards,

-

WiseMapping Team.

\ No newline at end of file diff --git a/wise-webapp/src/main/webapp/jsp/installCFG.jsp b/wise-webapp/src/main/webapp/jsp/installCFG.jsp index f00f528f..85c53f52 100644 --- a/wise-webapp/src/main/webapp/jsp/installCFG.jsp +++ b/wise-webapp/src/main/webapp/jsp/installCFG.jsp @@ -1,10 +1,6 @@ -<%@ page import="org.apache.log4j.Logger" %> <%@ page autoFlush="true" buffer="none" %> <%@ include file="/jsp/init.jsp" %> -<%! - final Logger logger = Logger.getLogger("com.wisemapping"); -%>
diff --git a/wise-webapp/src/main/webapp/jsp/login.jsp b/wise-webapp/src/main/webapp/jsp/login.jsp index ec38b153..c8a50ecc 100644 --- a/wise-webapp/src/main/webapp/jsp/login.jsp +++ b/wise-webapp/src/main/webapp/jsp/login.jsp @@ -15,7 +15,7 @@

What is New:

    -
  • Links Between Nodes
  • +
  • Complerly new UI
  • FreeMind 0.9 Update
  • Improved HTML 5.0 Support
  • Firefox 12 officially supported
  • diff --git a/wise-webapp/src/main/webapp/jsp/forgotPassword.jsp b/wise-webapp/src/main/webapp/jsp/userForgotPassword.jsp similarity index 64% rename from wise-webapp/src/main/webapp/jsp/forgotPassword.jsp rename to wise-webapp/src/main/webapp/jsp/userForgotPassword.jsp index 292d05f1..e8587561 100755 --- a/wise-webapp/src/main/webapp/jsp/forgotPassword.jsp +++ b/wise-webapp/src/main/webapp/jsp/userForgotPassword.jsp @@ -1,33 +1,39 @@ -<%@ include file="/jsp/init.jsp" %> - - -
    -
    -

    - -

    -

    - - -
    - - - - - " class="btn btn-primary"/> - " class="btn" - onclick="window.location=''"/> -
    -
    -
    -
    - -
    - - - - - - - +<%@ include file="/jsp/init.jsp" %> + + +
    +
    +

    + +

    + +

    + + +
    + + + + " class="btn btn-primary" data-loading-text="Saving ..."/> + " class="btn" + onclick="window.location=''"/> +
    +
    +
    +
    + +
    + + + + + + +
    \ No newline at end of file diff --git a/wise-webapp/src/main/webapp/jsp/userForgotPasswordError.jsp b/wise-webapp/src/main/webapp/jsp/userForgotPasswordError.jsp new file mode 100755 index 00000000..9917ba5c --- /dev/null +++ b/wise-webapp/src/main/webapp/jsp/userForgotPasswordError.jsp @@ -0,0 +1,6 @@ +<%@ include file="/jsp/init.jsp" %> + +

    The email is not register or you account is not active yet.

    + +

    If the problem persist please send us an email to support@wisemapping.com

    diff --git a/wise-webapp/src/main/webapp/jsp/userForgotPasswordSuccess.jsp b/wise-webapp/src/main/webapp/jsp/userForgotPasswordSuccess.jsp new file mode 100644 index 00000000..8351859f --- /dev/null +++ b/wise-webapp/src/main/webapp/jsp/userForgotPasswordSuccess.jsp @@ -0,0 +1,12 @@ +<%@ include file="/jsp/init.jsp" %> + +

    + Your temporal password has been sent +

    + +

    + We've sent you an email that will allow you to reset your password quickly and easily. Please check your email now. +

    + +

    If you have any problem receiving the email, contact us to support@wisemapping.com

    diff --git a/wise-webapp/src/main/webapp/jsp/userRegistrationConfirmation.jsp b/wise-webapp/src/main/webapp/jsp/userRegistrationSuccess.jsp similarity index 100% rename from wise-webapp/src/main/webapp/jsp/userRegistrationConfirmation.jsp rename to wise-webapp/src/main/webapp/jsp/userRegistrationSuccess.jsp