Finish account settings option.

This commit is contained in:
Paulo Gustavo Veiga 2012-06-20 13:28:45 -03:00
parent a845a87183
commit cfe78bdf7e
46 changed files with 387 additions and 1179 deletions

View File

@ -5,124 +5,5 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>messages</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/wisemapping-security.xml
/WEB-INF/wisemapping-dao.xml
/WEB-INF/wisemapping-service.xml
/WEB-INF/wisemapping-model.xml
/WEB-INF/wisemapping-acegi-security.xml
</param-value>
</context-param>
<!--
- Loads the root application context of this web app at startup.
- The application context is then available via
- WebApplicationContextUtils.getWebApplicationContext(servletContext).
-->
<listener>
<listener-class>com.wisemapping.service.HibernateAppListener</listener-class>
</listener>
<filter>
<filter-name>charsetFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>charsetFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>hibernate</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>mindmapSessionFactory</param-value>
</init-param>
</filter>
<filter>
<filter-name>Acegi Filter Chain Proxy</filter-name>
<filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>org.acegisecurity.util.FilterChainProxy</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Acegi Filter Chain Proxy</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>hibernate</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>wisemapping</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/wisemapping-servlet.xml
/WEB-INF/wisemapping-captcha.xml
</param-value>
</init-param>
</servlet>
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>wisemapping</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>180</session-timeout>
</session-config>
</web-app>

View File

@ -1,72 +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.service.UserService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ActivationController
implements Controller, InitializingBean
{
//~ Instance fields ......................................................................................
private UserService userService;
//~ Methods ..............................................................................................
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
throws Exception
{
ModelAndView modelAndView;
try
{
final String code = request.getParameter("code");
userService.activateAccount(Long.parseLong(code));
modelAndView = new ModelAndView("activationAccountConfirmation");
}
catch (Throwable exc)
{
// TODO Fix it !
exc.printStackTrace();
// Any type of error
modelAndView = new ModelAndView("activationAccountConfirmationFail");
}
return modelAndView;
}
public void setUserService(UserService userService) {
this.userService = userService;
}
/**
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
*/
public void afterPropertiesSet()
throws Exception {
if (userService == null) {
throw new RuntimeException("userService was not set!");
}
}
}

View File

@ -1,67 +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.model.MindMap;
import com.wisemapping.service.MindmapService;
import com.wisemapping.service.UserService;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;
import javax.servlet.http.HttpServletRequest;
public class BaseSimpleFormController extends SimpleFormController
{
private MindmapService mindmapService;
private UserService userService;
private String errorView;
public UserService getUserService() {
return userService;
}
public void setUserService(UserService userService) {
this.userService = userService;
}
public MindmapService getMindmapService() {
return mindmapService;
}
public String getErrorView() {
return errorView;
}
@Override protected org.springframework.web.servlet.ModelAndView showForm(javax.servlet.http.HttpServletRequest httpServletRequest, javax.servlet.http.HttpServletResponse httpServletResponse, org.springframework.validation.BindException bindException) throws java.lang.Exception
{
final ModelAndView view = super.showForm(httpServletRequest, httpServletResponse,bindException);
final String viewName = getErrorView();
if(viewName !=null && bindException.getAllErrors().size()>0)
{
view.setViewName(viewName);
view.addObject("errorView",true);
}
return view;
}
}

View File

@ -1,53 +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.model.User;
import com.wisemapping.security.Utils;
import com.wisemapping.service.UserService;
import com.wisemapping.view.ChangePasswordBean;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ChangePasswordController
extends BaseSimpleFormController {
//~ Methods ..............................................................................................
public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command,
BindException errors)
throws ServletException {
final ChangePasswordBean bean = (ChangePasswordBean) command;
// Reload user only in case of being necessary...
final User model = Utils.getUser();
final UserService userService = this.getUserService();
final User user = userService.reloadUser(model);
user.setPassword(bean.getPassword());
userService.changePassword(user);
return new ModelAndView(getSuccessView());
}
}

View File

@ -1,65 +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.model.User;
import com.wisemapping.security.Utils;
import com.wisemapping.service.UserService;
import com.wisemapping.view.UserBean;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class EditProfileController extends BaseSimpleFormController {
protected Object formBackingObject(HttpServletRequest httpServletRequest) throws Exception {
final User model = Utils.getUser();
return new UserBean(model);
}
//~ Methods ..............................................................................................
public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command,
BindException errors)
throws ServletException {
final UserBean bean = (UserBean) command;
final UserService userService = this.getUserService();
// Reload user only in case of beeing necessary...
final User model = Utils.getUser();
final User user = userService.reloadUser(model);
user.setFirstname(bean.getFirstname());
user.setLastname(bean.getLastname());
// trim() the email email in order to remove spaces
user.setEmail(bean.getEmail().trim());
user.setAllowSendEmail(bean.isAllowSendEmail());
// Sync Acegi user and DB user
model.setAllowSendEmail(bean.isAllowSendEmail());
userService.updateUser(user);
return new ModelAndView(getSuccessView());
}
}

View File

@ -1,33 +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 org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class SettingsController {
public ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException noSuchRequestHandlingMethodException, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
throws Exception {
return new ModelAndView("setting");
}
}

View File

@ -1,60 +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.WiseMappingException;
import com.wisemapping.importer.ImporterException;
import com.wisemapping.model.MindMap;
import com.wisemapping.model.User;
import com.wisemapping.security.Utils;
import com.wisemapping.view.TagBean;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class TagsController
extends BaseSimpleFormController {
//~ Methods ..............................................................................................
protected Object formBackingObject(HttpServletRequest httpServletRequest) throws Exception {
final MindMap mindmap = null;
final User user = Utils.getUser();
final User dbUser = getUserService().getUserBy(user.getId());
final TagBean tagBean = new TagBean();
tagBean.setUserTags(dbUser.getTags());
tagBean.setMindmapId(mindmap.getId());
tagBean.setMindmapTags(mindmap.getTags());
tagBean.setMindmapTitle(mindmap.getTitle());
return tagBean;
}
public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors)
throws ServletException, WiseMappingException, ImporterException
{
final TagBean bean = (TagBean) command;
final MindMap mindmap = getMindmapService().findMindmapById(bean.getMindmapId());
getMindmapService().addTags(mindmap, bean.getMindmapTags());
return new ModelAndView(getSuccessView());
}
}

View File

@ -1,132 +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.model.User;
import com.wisemapping.service.UserService;
import com.wisemapping.view.UserBean;
import com.wisemapping.exceptions.WiseMappingException;
import net.tanesha.recaptcha.ReCaptcha;
import net.tanesha.recaptcha.ReCaptchaResponse;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.springframework.validation.BindException;
import org.springframework.validation.ObjectError;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
public class UserRegistrationController
extends BaseSimpleFormController {
//~ Instance fields ......................................................................................
private boolean emailConfirmEnabled;
private UserService userService;
private ReCaptcha captchaService;
private boolean captchaEnabled;
//~ Methods ..............................................................................................
public boolean isEmailConfirmEnabled() {
return emailConfirmEnabled;
}
public void setEmailConfirmEnabled(boolean emailConfirmEnabled) {
this.emailConfirmEnabled = emailConfirmEnabled;
}
public ModelAndView onSubmit(@Nullable Object command) throws WiseMappingException {
final UserBean userBean = ((UserBean) command);
if (userBean != null) {
final User user = new User();
// trim() the email email in order to remove spaces
user.setEmail(userBean.getEmail().trim());
user.setUsername(userBean.getUsername());
user.setFirstname(userBean.getFirstname());
user.setLastname(userBean.getLastname());
user.setPassword(userBean.getPassword());
userService.createUser(user, emailConfirmEnabled);
}
final Map<String, Object> model = new HashMap<String, Object>();
model.put("confirmByEmail", emailConfirmEnabled);
return new ModelAndView(getSuccessView(), model);
}
public void setUserService(UserService userService) {
this.userService = userService;
}
public void setCaptchaService(@NotNull final ReCaptcha captchaService) {
this.captchaService = captchaService;
}
public ReCaptcha getCaptchaService() {
return captchaService;
}
public boolean isCaptchaEnabled() {
return captchaEnabled;
}
public void setCaptchaEnabled(boolean captchaEnabled) {
this.captchaEnabled = captchaEnabled;
}
@Override
protected void onBindAndValidate(HttpServletRequest request, Object command, BindException errors) throws Exception {
super.onBindAndValidate(request, command, errors);
// If captcha is enabled, generate it ...
if (isCaptchaEnabled()) {
final String challenge = request.getParameter("recaptcha_challenge_field");
final String uresponse = request.getParameter("recaptcha_response_field");
final String remoteAddr = request.getRemoteAddr();
final ReCaptchaResponse reCaptchaResponse = captchaService.checkAnswer(remoteAddr, challenge, uresponse);
if (!reCaptchaResponse.isValid()) {
errors.rejectValue("captcha", Messages.CAPTCHA_ERROR);
}
}
}
@Override
protected ModelAndView showForm(HttpServletRequest request, HttpServletResponse response, BindException bindException) throws Exception {
final ModelAndView modelAndView = super.showForm(request, response, bindException);
// If captcha is enabled, generate it ...
if (isCaptchaEnabled()) {
final Properties prop = new Properties();
prop.put("theme", "white");
final String captchaHtml = captchaService.createRecaptchaHtml(null, prop);
request.setAttribute("captchaHtml", captchaHtml);
request.setAttribute("captchaEnabled", true);
}
return modelAndView;
}
}

View File

@ -34,8 +34,6 @@ public interface UserManager {
User getUserByUsername(String username);
boolean authenticate(String email, String password);
void createUser(User user);
void auditLogin(UserLogin userLogin);

View File

@ -86,14 +86,6 @@ public class UserManagerImpl
return user;
}
@Override
public boolean authenticate(final String email, final String password) {
final boolean result;
final User user = getUserBy(email);
result = user != null && user.getPassword().equals(password);
return result;
}
@Override
public void createUser(User user) {
assert user != null : "Trying to store a null user";
@ -134,7 +126,7 @@ public class UserManagerImpl
getHibernateTemplate().save(userLogin);
}
public void updateUser(User user) {
public void updateUser(@NotNull User user) {
assert user != null : "user is null";
user.setPassword(passwordEncoder.encodePassword(user.getPassword(), null));
getHibernateTemplate().update(user);

View File

@ -49,7 +49,7 @@ final public class NotificationService {
final String collabEmail = collaboration.getCollaborator().getEmail();
// Build the subject ...
final String subject = user.getFullName() + " has shared a mindmap with you";
final String subject = "[WiseMapping] " + user.getFullName() + " has shared a mindmap with you";
// Fill template properties ...
final Map<String, Object> model = new HashMap<String, Object>();
@ -70,15 +70,44 @@ final public class NotificationService {
}
public void resetPassword(@NotNull User user, @NotNull String temporalPassword) {
final String mailSubject = "[WiseMapping] Your new password";
final String messageTitle = "Your new password has been generated";
final String messageBody =
"<p>Someone, most likely you, requested a new password for your WiseMapping account. </p>\n" +
"<p><strong>Here is your new password: : " + temporalPassword + "</strong></p>\n" +
"<p>You can login clicking <a href=\"" + this.baseUrl + "/c/login\">here</a>. We strongly encourage you to change the password as soon as possible.</p>";
sendTemplateMail(user, mailSubject, messageTitle, messageBody);
}
public void passwordChanged(@NotNull User user) {
final String mailSubject = "[WiseMapping] Your password has been changed";
final String messageTitle = "Your password has been changed successfully";
final String messageBody =
"<p>This is only an notification that your password has been changed. No further action is required.</p>";
sendTemplateMail(user, mailSubject, messageTitle, messageBody);
}
public void newAccountCreated(@NotNull User user) {
final String mailSubject = "Welcome to WiseMapping !";
final String messageTitle = "Your account has been created successfully";
final String messageBody =
"<p> Thank you for your interest in WiseMapping. If have any feedback or idea, send us an email to <a href=\"mailto:feedback@wisemapping.com\">feedback@wisemapping.com</a> .We'd love to hear from you.</p>";
sendTemplateMail(user, mailSubject, messageTitle, messageBody);
}
private void sendTemplateMail(@NotNull User user, @NotNull String mailSubject, @NotNull String messageTitle, @NotNull String messageBody) {
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("firstName", user.getFirstname());
model.put("messageTitle", messageTitle);
model.put("messageBody", messageBody);
model.put("baseUrl", this.baseUrl);
model.put("supportEmail", mailer.getSupportEmail());
mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), "Reset Your WiseMapping Password", model, "passwordRecovery.vm");
mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), mailSubject, model, "baseLayout.vm");
} catch (Exception e) {
handleException(e);
}
@ -100,7 +129,7 @@ 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");
mailer.sendEmail(mailer.getServerSenderEmail(), user.getEmail(), "[WiseMapping] Active account", model, "activationAccountMail.vm");
}
public void sendRegistrationEmail(@NotNull User user) {

View File

@ -1,41 +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.mail;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
public class SmtpAuthenticator
extends Authenticator
{
private String username;
private String password;
public SmtpAuthenticator(String username, String password)
{
super();
this.username = username;
this.password = password;
}
public PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication(username, password);
}
}

View File

@ -58,6 +58,7 @@ public class MindmapController {
public String showDetails(@PathVariable int id, @NotNull Model model) {
final MindMapBean mindmap = findMindmapBean(id);
model.addAttribute("mindmap", mindmap);
model.addAttribute("baseUrl", siteBaseUrl);
return "mindmapDetail";
}

View File

@ -19,9 +19,10 @@
package com.wisemapping.ncontroller;
import com.wisemapping.controller.Messages;
import com.wisemapping.validator.Messages;
import com.wisemapping.exceptions.WiseMappingException;
import com.wisemapping.model.User;
import com.wisemapping.security.Utils;
import com.wisemapping.service.InvalidUserEmailException;
import com.wisemapping.service.UserService;
import com.wisemapping.validator.UserValidator;
@ -33,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
@ -119,6 +121,12 @@ public class UsersController {
return result;
}
@RequestMapping(value = "account/settings", method = RequestMethod.GET)
public String showUserSettingsPage(@NotNull Model model) {
model.addAttribute("user", Utils.getUser());
return "accountSettings";
}
private BindingResult validateRegistrationForm(@NotNull UserBean userBean, @NotNull HttpServletRequest request, @NotNull BindingResult bindingResult) {
final UserValidator userValidator = new UserValidator();
userValidator.setUserService(userService);

View File

@ -0,0 +1,71 @@
/*
* 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.rest;
import com.wisemapping.model.User;
import com.wisemapping.security.Utils;
import com.wisemapping.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@Controller
public class AccountController extends BaseController {
@Qualifier("userService")
@Autowired
private UserService userService;
@RequestMapping(method = RequestMethod.PUT, value = "account/password", consumes = {"text/plain"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void changePassword(@RequestBody String password) {
if (password == null) {
throw new IllegalArgumentException("Password can not be null");
}
final User user = Utils.getUser();
user.setPassword(password);
userService.changePassword(user);
}
@RequestMapping(method = RequestMethod.PUT, value = "account/firstname", consumes = {"text/plain"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void changeFirstname(@RequestBody String firstname) {
if (firstname == null) {
throw new IllegalArgumentException("Firstname can not be null");
}
final User user = Utils.getUser();
user.setFirstname(firstname);
userService.updateUser(user);
}
@RequestMapping(method = RequestMethod.PUT, value = "account/lastname", consumes = {"text/plain"})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
public void changeLastName(@RequestBody String lastname) {
if (lastname == null) {
throw new IllegalArgumentException("lastname can not be null");
}
final User user = Utils.getUser();
user.setLastname(lastname);
userService.updateUser(user);
}
}

View File

@ -23,6 +23,7 @@ import com.wisemapping.model.User;
import com.wisemapping.rest.model.RestUser;
import com.wisemapping.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@ -33,6 +34,7 @@ import java.io.IOException;
@Controller
public class AdminController extends BaseController {
@Qualifier("userService")
@Autowired
private UserService userService;

View File

@ -62,7 +62,7 @@ public class UserServiceImpl
// Generate a random password ...
final String password = randomstring(8, 10);
user.setPassword(password);
changePassword(user);
updateUser(user);
// Send an email with the new temporal password ...
notificationService.resetPassword(user, password);
@ -119,11 +119,16 @@ public class UserServiceImpl
// Send registration email.
if (emailConfirmEnabled) {
notificationService.sendRegistrationEmail(user);
} else {
// Send a welcome email ..
notificationService.newAccountCreated(user);
}
return user;
}
public void changePassword(@NotNull User user) {
notificationService.passwordChanged(user);
userManager.updateUser(user);
}

View File

@ -1,59 +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 org.springframework.validation.ValidationUtils;
import com.wisemapping.view.ChangePasswordBean;
import com.wisemapping.model.Constants;
public class ChangePasswordValidator
implements Validator {
public boolean supports(final Class clazz) {
return clazz.equals(ChangePasswordBean.class);
}
public void validate(Object obj, Errors errors) {
ChangePasswordBean bean = (ChangePasswordBean) obj;
if (bean == null) {
errors.rejectValue("changePassword", "error.not-specified", null, "Value required.");
} else {
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "required", "Field is required.");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "retryPassword", "required", "Field is required.");
ValidatorUtils.rejectIfExceeded(errors,
"password",
"The password must have less than "+ Constants.MAX_USER_PASSWORD_LENGTH + " characters.",
bean.getPassword(),
Constants.MAX_USER_PASSWORD_LENGTH);
ValidatorUtils.rejectIfExceeded(errors,
"retryPassword",
"The retryPassword must have less than "+ Constants.MAX_USER_PASSWORD_LENGTH + " characters.",
bean.getRetryPassword(),
Constants.MAX_USER_PASSWORD_LENGTH);
final String password = bean.getPassword();
if (password != null && !password.equals(bean.getRetryPassword())) {
errors.rejectValue("password", "Password mismatch", "Your password entries did not match");
}
}
}
}

View File

@ -1,72 +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 com.wisemapping.view.UserBean;
import com.wisemapping.controller.Messages;
import com.wisemapping.service.UserService;
import com.wisemapping.model.User;
import com.wisemapping.model.Constants;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
public class EditProfileValidator implements Validator {
private UserService userService;
public boolean supports(final Class clazz) {
return clazz.equals(UserBean.class);
}
public void validate(Object obj, Errors errors) {
UserBean user = (UserBean) obj;
if (user == null) {
errors.rejectValue("user", "error.not-specified", null, "Value required.");
} else {
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "firstname", "required", "Field is required.");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "lastname", "required", "Field is required.");
ValidatorUtils.rejectIfExceeded(errors,
"firstname",
"The firstname must have less than "+ Constants.MAX_USER_FIRSTNAME_LENGTH + " characters.",
user.getFirstname(),
Constants.MAX_USER_FIRSTNAME_LENGTH);
ValidatorUtils.rejectIfExceeded(errors,
"lastname",
"The lastname must have less than "+ Constants.MAX_USER_LASTNAME_LENGTH + " characters.",
user.getLastname(),
Constants.MAX_USER_LASTNAME_LENGTH);
final String email = user.getEmail();
boolean isValid = Utils.isValidateEmailAddress(email);
if (isValid) {
final User oldUser = userService.getUserBy(email);
if (oldUser != null && user.getId() != oldUser.getId()) {
errors.rejectValue("email", Messages.EMAIL_ALREADY_EXIST);
}
} else {
Utils.validateEmailAddress(email, errors);
}
}
}
public void setUserService(UserService userService) {
this.userService = userService;
}
}

View File

@ -18,7 +18,6 @@
package com.wisemapping.validator;
import com.wisemapping.controller.Messages;
import com.wisemapping.model.MindMap;
import com.wisemapping.model.User;
import com.wisemapping.model.Constants;

View File

@ -16,7 +16,7 @@
* limitations under the License.
*/
package com.wisemapping.controller;
package com.wisemapping.validator;
public interface Messages {
String EMAIL_ALREADY_EXIST = "EMAIL_ALREADY_EXIST";

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 com.wisemapping.model.Constants;
import com.wisemapping.view.TagBean;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
public class TagValidator implements Validator {
public boolean supports(final Class clazz) {
return clazz.equals(TagBean.class);
}
public void validate(Object obj, Errors errors) {
TagBean tag = (TagBean) obj;
if (tag == null) {
errors.rejectValue("user", "error.not-specified");
} else {
// Validate email address ...
final String tags = tag.getMindmapTags();
ValidatorUtils.rejectIfExceeded(errors,
"mindmapTags",
"The tags must have less than "+ Constants.MAX_TAGS_LENGTH + " characters.",
tags,
Constants.MAX_TAGS_LENGTH);
}
}
}

View File

@ -18,7 +18,6 @@
package com.wisemapping.validator;
import com.wisemapping.controller.Messages;
import com.wisemapping.service.UserService;
import com.wisemapping.view.UserBean;
import com.wisemapping.model.Constants;

View File

@ -24,8 +24,6 @@ import org.springframework.validation.ValidationUtils;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import com.wisemapping.controller.Messages;
final public class Utils {
//Set the email emailPattern string

View File

@ -1,67 +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;
import java.util.Set;
public class TagBean
{
private Set<String> userTags;
private String mindmapTitle;
private int mindmapId;
private String mindmapTags;
public TagBean(){}
public Set<String> getUserTags() {
return userTags;
}
public void setUserTags(Set<String> tags) {
this.userTags = tags;
}
public String getMindmapTags() {
return mindmapTags;
}
public void setMindmapTags(String tags) {
this.mindmapTags = tags;
}
public String getMindmapTitle()
{
return mindmapTitle;
}
public void setMindmapTitle(String title)
{
this.mindmapTitle = title;
}
public int getMindmapId()
{
return mindmapId;
}
public void setMindmapId(int id)
{
this.mindmapId = id;
}
}

View File

@ -10,28 +10,32 @@
<a href="${baseUrl}">
<img style="border: 0;margin-top: 10px;"
src="${baseUrl}/images/logo-small.png"
alt="WiseMapping Log"/>
alt="WiseMapping"/>
</a>
</td>
<td valign="bottom" height="32px" style="padding: 0;font-size: 16px;">
Your password has been reset
${messageTitle}
</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>
Hi ${firstName}:
<p>
${messageBody}
</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>
<p style="color: #898989;">Regards,<br/>
The WiseMapping Team<br/>
</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>.
you need further help or believe you have received this email in error, contact us to <a
href="mailto:${supportEmail}">here</a>.
</p>
</body>
</html>

View File

@ -9,7 +9,7 @@
</p>
<p>
If you have received this mail by error, you do not need to take any action to cancel the account. The account will
not be activated, and you will not receive any futher emails.
not be activated, and you will not receive any further emails.
</p>
<p>

View File

@ -1,41 +0,0 @@
<html>
<body>
<div style="background-color: #d1e4f0; max-width: 650px; font-family: Arial, sans-serif; color: #000; padding: 5px;">
<div style="height: 36px; font-size: 14px; font-weight: bold; padding-bottom: 4px;">
<table style="display: inline;width: 100%;">
<tbody>
<tr>
<td height="35px" width="2px" style="padding: 0; padding-right: 5px; text-align:center">
<img src="https://ssl.gstatic.com/docs/documents/share/images/services/document-1.png"
alt="Document"/>
</td>
<td valign="middle" height="32px" style="padding: 0;">I've shared <a
href='https://docs.google.com/document/d/1kx48Yhpt01y2LZnIVGJNgKTg_IlvQMh=47R2NIwRn4Hg/edit'>Untitled
document
</a>
</td>
</tr>
</tbody>
</table>
</div>
<div style="font-size: 13px; background-color: #FFF; padding: 10px 7px 7px 7px;">
Click to open:
<ul style="list-style-type: none; padding: 0; margin: 0;">
<li style="margin: 0;">
<a href="https://docs.google.com/document/d/1kx48Yhpt01y2LZnIVG=JNgKTg_IlvQMh47R2NIwRn4Hg/edit">Untitled
document</a></li>
</ul>
<span style="color: #898989;">Google Docs makes it easy to create, store and share online documents, spreadsheets and presentations.</span>
<div style="text-align: right;">
<a href="https://docs.google.com">
<img style="border: 0;margin-top: 10px;"
src="https://ssl.gstatic.com/docs/documents/share/images/services/docs_logo-1.gif"
alt="Logo for Google Docs"/>
</a>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,23 +0,0 @@
<html>
<body style="font-family: Arial, sans-serif; color: #000;">
<p>
Hi,
</p>
<p>
Thank you so much for your interest in WiseMapping. Your subscription was a success! If you have any questions or
have any feedback, please don't hesitate to reply to this email, or use the on line form. We'd love to hear from
you.
</p>
<p>
For questions or concerns regarding your account, send us an email to ${supportEmail}.
</p>
<p>
Cheers, <br/>
The WiseMapping Team.
<a href="${baseUrl}">WiseMapping Site</a>
</p>
</body>
</html>

View File

@ -11,6 +11,7 @@ VIEWERS=Viewers
ADD_VIEWERS=Add Viewers
CURRENT_VIEWERS=Current Viewers
USER_REGISTRATION=User Registration
SEND_ME_A_NEW_PASSWORD=Send Me A New Password
CANCEL=Cancel
SUBMIT=Submit
FIRSTNAME=Firstname
@ -19,6 +20,8 @@ EMAIL=Email
HELP=Help
LOGOUT=Logout
PASSWORD=Password
NEW_PASSWORD=New password
CONFIRM_NEW_PASSWORD=Confirm new password
MY_WISEMAPS=My Wisemaps
SAVE_AND_CLOSE=Save and Close
RETYPE_PASSWORD=Retype Password
@ -26,7 +29,7 @@ REGISTER=Register
REMEMBER_ME=Stay signed in
SIGN_IN=Sign In
SIGN_UP=Sign Up
SETTINGS=Settings
ACCOUNT=Account
USERNAME=Username
BACK=Back
CLOSE=Close
@ -39,7 +42,7 @@ ROLE=Role
YOUR_ROLE=Your Role
CAPTCHA= Word Verification
FORGOT_PASSWORD=Forgot Password ?
CHANGE_PASSWORD=Change your Password
CHANGE_PASSWORD=Change Password
FAQ=Frequent Asked Questions
SHORT_FAQ=FAQ
LOGIN=Login
@ -99,6 +102,7 @@ EMAIL_ALREADY_EXIST=Email already exists
NO_VALID_EMAIL_ADDRESS=Invalid email address
USERNAME_ALREADY_EXIST=Username already exists
PASSWORD_MISSMATCH=Your password entries did not match
CHANGE_PASSWORD_SUCCESS=Your password has been changed successfully.
TYPE_CHARACTER_BELOW=Type the characters you see in the picture below.
WISEMAPPING_ACCOUNT_MESSAGE=Please check the WiseMapping Account information you've entered above, and review the Terms of Service
REGISTRATION_CLICK_ADVICE= By clicking on 'Register' below you are agreeing to the Terms of Service above and the Privacy Policy.
@ -139,7 +143,7 @@ INSERT=Insert
WISE_IT=Wise It!
EDITOR.LAST_SAVED=last modification by {0}
SHARE_IT=Share It
SETTINGS_DETAIL=Do you want to change you user options?. Here is the place.
ACCOUNT_DETAIL=Do you want to change you user options?. Here is the place.
SETTINGS_MSG=Please, select what option want to change from you profile:
TAGS=Tags
AVAILABLE_TAGS = Available tags

View File

@ -25,7 +25,7 @@ REGISTER=Registraci&oacute;n
REMEMBER_ME=Recordar mi sesi&oacute;n
SIGN_IN=Entrar
SIGN_UP=Registrate
SETTINGS=Configuraci&oacute;n
ACCOUNT=Configuraci&oacute;n
USERNAME=Nombre de usuario
BACK=Atr&aacute;s
CLOSE=Cerrar
@ -141,7 +141,7 @@ INSERT=Insertar
WISE_IT=Wise It!
EDITOR.LAST_SAVED=ultima modificaci&oacute;n hecha por {0}
SHARE_IT=Compartilo
SETTINGS_DETAIL=Desea cambiar sus preferencias? Este es el lugar.
ACCOUNT_DETAIL=Desea cambiar sus preferencias? Este es el lugar.
SETTINGS_MSG=Por favor, seleccione que opci&oacute;n desea modificar de su perfil:
TAGS=Etiquetas
AVAILABLE_TAGS = Etiquetas disponibles

View File

@ -25,7 +25,7 @@ REGISTER = S\'inscrire
REMEMBER_ME = M\u00e9moriser
SIGN_IN = S\'identifier
SIGN_UP = Se d\u00e9connecter
SETTINGS = Param\u00e9tres du compte
ACCOUNT = Param\u00e9tres du compte
USERNAME = Pseudo
BACK = Pr\u00e9c\u00e9dent
CLOSE = Fermer
@ -145,7 +145,7 @@ INSERT = Ins\u00e9rer
EDITOR.LAST_SAVED = Derni\u00e9re modification par
SHARE_IT = Partager
SETTINGS_DETAIL = Souhaitez-vous modifier les options de votre profil ?
ACCOUNT_DETAIL = Souhaitez-vous modifier les options de votre profil ?
SETTINGS_MSG = S\u00e9lectionnez les options que vous souhaitez modifier dans votre profil
TAGS = Mots-cl\u00e9s
AVAILABLE_TAGS = Mots-cl\u00e9s disponibles

View File

@ -94,10 +94,9 @@
<put-attribute name="body" value="/jsp/mindmapDetail.jsp"/>
</definition>
<definition name="setting" extends="dialogTemplate">
<definition name="accountSettings" extends="dialogTemplate">
<put-attribute name="title" value="SETTINGS"/>
<put-attribute name="details" value="SETTINGS_MSG"/>
<put-attribute name="body" value="/jsp/setting.jsp"/>
<put-attribute name="body" value="/jsp/accountSettings.jsp"/>
</definition>
<definition name="editProfile" extends="dialogTemplate">
@ -173,11 +172,4 @@
<put-attribute name="details" value="KEYBOARD_MSG"/>
<put-attribute name="body" value="/jsp/keyboard.jsp"/>
</definition>
<definition name="changePassword" extends="dialogTemplate">
<put-attribute name="title" value="CHANGE_PASSWORD"/>
<put-attribute name="details" value="FIELD_REQUIRED_MSG"/>
<put-attribute name="body" value="/jsp/changePassword.jsp"/>
</definition>
</tiles-definitions>

View File

@ -90,8 +90,7 @@
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
<!--/WEB-INF/wisemapping-servlet.xml-->
/WEB-INF/wisemapping-nservlet.xml
/WEB-INF/wisemapping-servlet.xml
</param-value>
</init-param>

View File

@ -1,97 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
<context:component-scan base-package="com.wisemapping.ncontroller"/>
<context:annotation-config/>
<mvc:annotation-driven/>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="/WEB-INF/app.properties"/>
</bean>
<bean id="exceptionHandlerResolver"
class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="defaultStatusCode" value="500"/>
<property name="defaultErrorView" value="unexpectedError"/>
<property name="exceptionMappings">
<props>
<prop key="com.wisemapping.exceptions.UnsupportedBrowserException">browserNotSupported</prop>
<!-- Security exceptions are wrapped in this exceptions -->
<prop key="java.lang.reflect.UndeclaredThrowableException">securityError</prop>
</props>
</property>
</bean>
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
</bean>
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/defs/definitions.xml</value>
</list>
</property>
</bean>
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="en"/>
</bean>
<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="language"/>
</bean>
<bean id="reCaptcha" class="net.tanesha.recaptcha.ReCaptchaImpl">
<property name="privateKey" value="${registration.recaptcha.privateKey}"/>
<property name="publicKey" value="${registration.recaptcha.publicKey}"/>
<property name="includeNoscript" value="false"/>
</bean>
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="522240"/>
</bean>
<bean id="browserSupportInterceptor" class="com.wisemapping.filter.BrowserSupportInterceptor">
<property name="exclude">
<list>
<value>/</value>
<value>/index.jsp</value>
<value>/c/home</value>
<value>/c/login</value>
<value>/c/user/registration</value>
<value>/c/captcha</value>
<value>/c/publicView</value>
<value>/service/*</value>
<value>/c/search</value>
<value>/c/keyboard</value>
<value>/c/renameMap</value>
<value>/c/embeddedView</value>
<value>/c/user/resetPassword</value>
</list>
</property>
</bean>
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>messages</value>
</list>
</property>
</bean>
</beans>

View File

@ -1,51 +1,97 @@
<?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 xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
<beans>
<context:component-scan base-package="com.wisemapping.ncontroller"/>
<context:annotation-config/>
<mvc:annotation-driven/>
<bean id="userValidator" class="com.wisemapping.validator.UserValidator">
<property name="userService" ref="userService"/>
<property name="captchaService" ref="reCaptcha"/>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="/WEB-INF/app.properties"/>
</bean>
<bean id="settingResolver" class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver">
<property name="mappings">
<bean id="exceptionHandlerResolver"
class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="defaultStatusCode" value="500"/>
<property name="defaultErrorView" value="unexpectedError"/>
<property name="exceptionMappings">
<props>
<prop key="settings">settings</prop>
<prop key="com.wisemapping.exceptions.UnsupportedBrowserException">browserNotSupported</prop>
<!-- Security exceptions are wrapped in this exceptions -->
<prop key="java.lang.reflect.UndeclaredThrowableException">securityError</prop>
</props>
</property>
</bean>
<bean id="settingsController" class="com.wisemapping.controller.SettingsController">
<property name="methodNameResolver" ref="settingResolver"/>
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/>
</bean>
<bean id="changePasswordValidator" class="com.wisemapping.validator.ChangePasswordValidator"/>
<bean id="changePasswordController" class="com.wisemapping.controller.ChangePasswordController">
<property name="sessionForm" value="false"/>
<property name="commandName" value="changePassword"/>
<property name="commandClass" value="com.wisemapping.view.ChangePasswordBean"/>
<property name="validator" ref="changePasswordValidator"/>
<property name="formView" value="changePassword"/>
<property name="successView" value="closeDialog"/>
<property name="userService" ref="userService"/>
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/defs/definitions.xml</value>
</list>
</property>
</bean>
<bean id="editProfileValidator" class="com.wisemapping.validator.EditProfileValidator">
<property name="userService" ref="userService"/>
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="en"/>
</bean>
<bean id="editProfileController" class="com.wisemapping.controller.EditProfileController">
<property name="sessionForm" value="false"/>
<property name="commandName" value="editProfile"/>
<property name="commandClass" value="com.wisemapping.view.UserBean"/>
<property name="validator" ref="editProfileValidator"/>
<property name="formView" value="editProfile"/>
<property name="successView" value="closeDialog"/>
<property name="userService" ref="userService"/>
<bean id="localeChangeInterceptor"
class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="language"/>
</bean>
<bean id="activationController" class="com.wisemapping.controller.ActivationController">
<property name="userService" ref="userService"/>
<bean id="reCaptcha" class="net.tanesha.recaptcha.ReCaptchaImpl">
<property name="privateKey" value="${registration.recaptcha.privateKey}"/>
<property name="publicKey" value="${registration.recaptcha.publicKey}"/>
<property name="includeNoscript" value="false"/>
</bean>
ans>
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="522240"/>
</bean>
<bean id="browserSupportInterceptor" class="com.wisemapping.filter.BrowserSupportInterceptor">
<property name="exclude">
<list>
<value>/</value>
<value>/index.jsp</value>
<value>/c/home</value>
<value>/c/login</value>
<value>/c/user/registration</value>
<value>/c/captcha</value>
<value>/c/publicView</value>
<value>/service/*</value>
<value>/c/search</value>
<value>/c/keyboard</value>
<value>/c/renameMap</value>
<value>/c/embeddedView</value>
<value>/c/user/resetPassword</value>
</list>
</property>
</bean>
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>messages</value>
</list>
</property>
</bean>
</beans>

View File

@ -0,0 +1,99 @@
<%@ include file="/jsp/init.jsp" %>
<div>
<ul class="nav nav-tabs">
<li class="active"><a href="#changeUserPanel" data-toggle="pill">General</a></li>
<li><a href="#changePasswordPanel" data-toggle="pill">Security</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="changeUserPanel">
<div id="changeInfoMsg" class="alert">
</div>
<form action="#" method="POST" id="changeUserForm">
<fieldset>
<label for="email"><strong><spring:message code="EMAIL"/>:</strong></label>
<input type="text" name="password" id="email" required="required" readonly="readonly"
value="${user.email}"/>
<label for="userName"><strong><spring:message code="USERNAME"/>:</strong></label>
<input type="text" name="password" id="userName" required="required" value="${user.username}"
readonly="readonly"/>
<label for="firstname"><strong><spring:message code="FIRSTNAME"/>:</strong></label>
<input type="text" name="firstname" id="firstname" required="required" value="${user.firstname}"/>
<label for="lastname"><strong><spring:message code="LASTNAME"/>:</strong></label>
<input type="text" name="lastname" id="lastname" required="required" value="${user.lastname}"/>
<br/>
<input type="submit" id="changeUserInfoBtn" class="btn btn-primary" value="Save"/>
</fieldset>
</form>
</div>
<div class="tab-pane fade" id="changePasswordPanel">
<div id="changePasswordMsg" class="alert">
</div>
<form action="#" method="POST" id="changePasswordForm">
<fieldset>
<label for="password"><strong><spring:message code="NEW_PASSWORD"/>:</strong></label>
<input type="password" name="password" id="password" required="required"/>
<label for="repassword"><strong><spring:message code="CONFIRM_NEW_PASSWORD"/>:</strong></label>
<input type="password" name="password" id="repassword" required="required"/>
<br/>
<input type="submit" id="changePasswordBtn" class="btn btn-primary"
value="<spring:message code="CHANGE_PASSWORD"/>"/>
</fieldset>
</form>
</div>
</div>
</div>
<script type="text/javascript">
$('#changePasswordMsg').hide();
function postChange(url, postBody, msgContainerId, successMsg) {
// Change success message ...
jQuery.ajax(url, {
async:false,
dataType: 'json',
data: postBody,
type: 'PUT',
contentType:"text/plain; charset=utf-8",
success : function(data, textStatus, jqXHR) {
$('#' + msgContainerId).removeClass('alert-error').addClass('alert-info').show();
$('#' + msgContainerId).text(successMsg);
},
error: function(jqXHR, textStatus, errorThrown) {
$('#' + msgContainerId).removeClass('alert-info').addClass('alert-error').show();
$('#' + msgContainerId).text(textStatus);
}
});
}
$('#changePasswordForm').submit(function(event) {
var inputVal = $('#changePasswordForm #password').val();
var rinputVal = $('#changePasswordForm #repassword').val();
if (inputVal != rinputVal) {
// Password mismatch message ...
$('#changePasswordMsg').removeClass('alert-info').addClass('alert-error').show();
$('#changePasswordMsg').text('<spring:message code="PASSWORD_MISSMATCH"/>');
} else {
postChange("service/account/password", inputVal, 'changePasswordMsg', '<spring:message code="CHANGE_PASSWORD_SUCCESS"/>');
}
event.preventDefault();
});
$('#changeUserForm').submit(function(event) {
var fistname = $('#changeUserForm #firstname').val();
var lastname = $('#changeUserForm #lastname').val();
postChange("service/account/firstname", fistname, 'changeInfoMsg', 'Your info has been changed successfully');
postChange("service/account/lastname", lastname, 'changeInfoMsg', 'Your info has been changed successfully');
event.preventDefault();
});
</script>

View File

@ -17,8 +17,8 @@
<spring:message code="MY_WISEMAPS"/>
</a>
| <a href="${pageContext.request.contextPath}/c/settings" rel="moodalbox 400px 250px wizard"
title="<spring:message code="SETTINGS_DETAIL"/>">
<spring:message code="SETTINGS"/>
title="<spring:message code="ACCOUNT_DETAIL"/>">
<spring:message code="ACCOUNT"/>
</a>
| <a href="${pageContext.request.contextPath}/c/logout" title="<spring:message code="LOGOUT"/>">
<spring:message code="LOGOUT"/>

View File

@ -1,17 +1,33 @@
<%@page pageEncoding="UTF-8"%>
<%@page pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<div id="settings-dialog-modal" class="modal fade">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3><spring:message code="ACCOUNT"/></h3>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button class="btn btn-cancel" data-dismiss="modal">Close</button>
</div>
</div>
<div id="header">
<div id="headerToolbar">
<c:choose>
<c:when test="${principal != null}">
<div id="headerActions">
<spring:message code="WELCOME"/>, ${principal.firstname}
| <span><a href="${pageContext.request.contextPath}/c/maps/"><spring:message code="MY_WISEMAPS"/></a></span>
| <span><a href="${pageContext.request.contextPath}/c/settings" title="<spring:message code="SETTINGS_DETAIL"/>"><spring:message code="SETTINGS"/></a></span>
| <span><a href="${pageContext.request.contextPath}/c/logout" title="<spring:message code="LOGOUT"/>"><spring:message code="LOGOUT"/></a></span>
| <span><a href="${pageContext.request.contextPath}/c/maps/"><spring:message
code="MY_WISEMAPS"/></a></span>
| <span><a id="userSettingsBtn" href="#"
title="<spring:message code="ACCOUNT_DETAIL"/>"><spring:message
code="ACCOUNT"/></a></span>
| <span><a href="${pageContext.request.contextPath}/c/logout"
title="<spring:message code="LOGOUT"/>"><spring:message code="LOGOUT"/></a></span>
</div>
</c:when>
<c:when test="${param.removeSignin!=true}">
@ -20,7 +36,7 @@
<span><a href="${pageContext.request.contextPath}/c/login" title="<spring:message code="SIGN_IN"/>">
<spring:message code="SIGN_IN"/>
</a></span>
</div>
</div>
</c:when>
</c:choose>
<div class="header_languages">
@ -38,13 +54,6 @@
</div>
<c:if test="${param.onlyActionHeader!=true}">
<div id="headerContent">
<div id="headerButtons">
<%--<div id="blogLink">--%>
<%--<a href="${pageContext.request.contextPath}/c/blog" title="<spring:message code="BLOG_TITLE"/>">--%>
<%--<spring:message code="BLOG"/>--%>
<%--</a>--%>
<%--</div>--%>
</div>
<a href="${pageContext.request.contextPath}/c/home" title="Homepage">
<div id="headerLogo">&nbsp;</div>
</a>
@ -55,3 +64,20 @@
</div>
</c:if>
<script type="text/javascript">
$('#userSettingsBtn').click(
function(event) {
$('#settings-dialog-modal .modal-body').load("/c/account/settings"),function() {
$('#settings-dialog-modal .btn-accept').unbind('click').click(function() {
// hacer lago ...
});
};
$('#settings-dialog-modal').modal();
event.preventDefault();
});
</script>

View File

@ -49,11 +49,11 @@
<li><strong><spring:message code="URL"/>:</strong>
<li><input name="url"
value="http://www.wisemapping.com/c/publicView?mapId=${mindmap.id}"
value="${baseUrl}/c/maps/${mindmap.id}/public"
style="width:400px" readonly="readonly"/>
</li>
<li><strong><spring:message code="BLOG_SNIPPET"/></strong>
<pre>&lt;iframe style="border:0;width:600px;height:400px;border: 1px solid black" src="http://www.wisemapping.com/c/embeddedView?mapId=${mindmap.id}&amp;amzoom=1"&gt;&lt;/iframe&gt;</pre>
<pre>&lt;iframe style="border:0;width:600px;height:400px;border: 1px solid black" src="${baseUrl}/c/maps/${mindmap.id}/embed?zoom=1"&gt;&lt;/iframe&gt;</pre>
</li>
<li><spring:message code="EMBEDDED_MAP_SIZE"/></li>
</ul>

View File

@ -64,9 +64,9 @@
<spring:message code="WELCOME"/>, ${principal.firstname}|<span><a
href="c/maps/"><spring:message code="MY_WISEMAPS"/></a></span> |
<span><a id="settings" href="c/settings"
title="<spring:message code="SETTINGS_DETAIL"/>"><spring:message code="SETTINGS"/></a></span>
| <span><a href="c/logout" title="<spring:message code="LOGOUT"/>">
<%--<span><a id="settings" href="c/settings"--%>
<%--title="<spring:message code="ACCOUNT_DETAIL"/>"><spring:message code="ACCOUNT"/></a></span> |--%>
<span><a href="c/logout" title="<spring:message code="LOGOUT"/>">
<spring:message code="LOGOUT"/>
</a></span>
</div>

View File

@ -115,7 +115,7 @@
<div id="dialogsContainer">
<!-- New map dialog -->
<div id="new-dialog-modal" title="Add new map" class="modal fade" style="display:none">
<div id="new-dialog-modal" title="Add new map" class="modal fade">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3>Create a new map</h3>
@ -144,7 +144,7 @@
</div>
<!-- Duplicate map dialog -->
<div id="duplicate-dialog-modal" class="modal fade" style="display: none">
<div id="duplicate-dialog-modal" class="modal fade">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3 id="dupDialogTitle"></h3>
@ -175,7 +175,7 @@
</div>
<!-- Rename map dialog -->
<div id="rename-dialog-modal" class="modal fade" style="display: none">
<div id="rename-dialog-modal" class="modal fade">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3 id="renameDialogTitle"></h3>
@ -204,7 +204,7 @@
</div>
<!-- Delete map dialog -->
<div id="delete-dialog-modal" class="modal fade" style="display: none">
<div id="delete-dialog-modal" class="modal fade">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3>Delete MindMap</h3>
@ -222,7 +222,7 @@
</div>
<!-- Info map dialog -->
<div id="info-dialog-modal" class="modal fade" style="display: none">
<div id="info-dialog-modal" class="modal fade">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3>Info</h3>
@ -236,7 +236,7 @@
</div>
<!-- Publish Dialog Config -->
<div id="publish-dialog-modal" class="modal fade" style="display: none">
<div id="publish-dialog-modal" class="modal fade">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3>Publish</h3>
@ -251,7 +251,7 @@
</div>
<!-- Export Dialog Config -->
<div id="export-dialog-modal" class="modal fade" style="display: none">
<div id="export-dialog-modal" class="modal fade">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3>Export</h3>
@ -266,7 +266,7 @@
</div>
<!-- Import Dialog Config -->
<div id="import-dialog-modal" class="modal fade" style="display: none">
<div id="import-dialog-modal" class="modal fade">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3>Import</h3>
@ -281,7 +281,7 @@
</div>
<!-- Share Dialog Config -->
<div id="share-dialog-modal" class="modal fade" style="display: none">
<div id="share-dialog-modal" class="modal fade">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3>Share</h3>
@ -296,7 +296,7 @@
</div>
<!-- History Dialog Config -->
<div id="history-dialog-modal" class="modal fade" style="display: none">
<div id="history-dialog-modal" class="modal fade" >
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3>History</h3>

View File

@ -1,4 +1,5 @@
<!DOCTYPE HTML>
<%@page pageEncoding="UTF-8" %>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@ include file="/jsp/init.jsp" %>

View File

@ -20,7 +20,7 @@
<label for="email"><spring:message code="EMAIL"/></label>
<input id="email" type="email" required="required" name="email"/>
<input type="submit" value="<spring:message code="SUBMIT"/>" class="btn btn-primary" data-loading-text="Saving ..."/>
<input type="submit" value="<spring:message code="SUBMIT"/>" class="btn btn-primary" data-loading-text="Seding ..."/>
<input type="button" value="<spring:message code="CANCEL"/>" class="btn"
onclick="window.location='<c:url value="c/maps/"/>'"/>
</fieldset>

View File

@ -1,17 +0,0 @@
<%@ include file="/jsp/init.jsp" %>
<div>
<ul>
<li><a rel="moodalbox 400px 200px wizard"
href="<c:out value="${pageContext.request.contextPath}/c/changePassword"/>"
title="<spring:message code="CHANGE_PASSWORD"/>">
<spring:message code="CHANGE_PASSWORD"/>
</a>
</li>
<li><a rel="moodalbox 400px 250px wizard"
href="<c:out value="${pageContext.request.contextPath}/c/editProfile"/>"
title="<spring:message code="EDIT_PROFILE"/>">
<spring:message code="EDIT_PROFILE"/>
</a>
</li>
</ul>
</div>