From 67908eeadccaa67a5948738b8f2abba3a6b6e690 Mon Sep 17 00:00:00 2001 From: interestinglife Date: Thu, 26 Aug 2021 18:08:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E9=A1=B5=E3=80=81=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E5=AF=86=E7=A0=81=E9=A1=B5=E6=B7=BB=E5=8A=A0=E5=8F=B3?= =?UTF-8?q?=E4=B8=8A=E8=A7=92=E7=B3=BB=E7=BB=9F=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/RegisterController.java | 4 +++- .../controller/ResetPasswordController.java | 19 ++++++++++++++++++- .../org/datagear/web/templates/register.ftl | 4 ++++ .../datagear/web/templates/reset_password.ftl | 4 ++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/datagear-web/src/main/java/org/datagear/web/controller/RegisterController.java b/datagear-web/src/main/java/org/datagear/web/controller/RegisterController.java index 85fa3a96d..dcf07642a 100644 --- a/datagear-web/src/main/java/org/datagear/web/controller/RegisterController.java +++ b/datagear-web/src/main/java/org/datagear/web/controller/RegisterController.java @@ -74,7 +74,7 @@ public void setUserService(UserService userService) } @RequestMapping - public String register(HttpServletRequest request, org.springframework.ui.Model model) + public String register(HttpServletRequest request, HttpServletResponse response, org.springframework.ui.Model model) { if (this.applicationProperties.isDisableRegister()) { @@ -86,6 +86,8 @@ public String register(HttpServletRequest request, org.springframework.ui.Model User user = new User(); model.addAttribute("user", user); + request.setAttribute("currentUser", WebUtils.getUser(request, response).cloneNoPassword()); + setDetectNewVersionScriptAttr(request, response, this.applicationProperties.isDisableDetectNewVersion()); return "/register"; } diff --git a/datagear-web/src/main/java/org/datagear/web/controller/ResetPasswordController.java b/datagear-web/src/main/java/org/datagear/web/controller/ResetPasswordController.java index 1c977dbff..da1b8deb0 100644 --- a/datagear-web/src/main/java/org/datagear/web/controller/ResetPasswordController.java +++ b/datagear-web/src/main/java/org/datagear/web/controller/ResetPasswordController.java @@ -18,7 +18,9 @@ import org.datagear.management.service.UserService; import org.datagear.util.FileUtil; import org.datagear.util.IDUtil; +import org.datagear.web.config.ApplicationProperties; import org.datagear.web.util.OperationMessage; +import org.datagear.web.util.WebUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -47,6 +49,9 @@ public class ResetPasswordController extends AbstractController @Autowired private File resetPasswordCheckFileDirectory; + @Autowired + private ApplicationProperties applicationProperties; + public ResetPasswordController() { super(); @@ -72,8 +77,18 @@ public void setResetPasswordCheckFileDirectory(File resetPasswordCheckFileDirect this.resetPasswordCheckFileDirectory = resetPasswordCheckFileDirectory; } + public ApplicationProperties getApplicationProperties() + { + return applicationProperties; + } + + public void setApplicationProperties(ApplicationProperties applicationProperties) + { + this.applicationProperties = applicationProperties; + } + @RequestMapping - public String resetPassword(HttpServletRequest request) + public String resetPassword(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); @@ -88,6 +103,8 @@ public String resetPassword(HttpServletRequest request) } request.setAttribute("step", resetPasswordStep); + request.setAttribute("currentUser", WebUtils.getUser(request, response).cloneNoPassword()); + setDetectNewVersionScriptAttr(request, response, this.applicationProperties.isDisableDetectNewVersion()); return "/reset_password"; } diff --git a/datagear-web/src/main/resources/org/datagear/web/templates/register.ftl b/datagear-web/src/main/resources/org/datagear/web/templates/register.ftl index c9e02bd0f..79c8ff606 100644 --- a/datagear-web/src/main/resources/org/datagear/web/templates/register.ftl +++ b/datagear-web/src/main/resources/org/datagear/web/templates/register.ftl @@ -11,6 +11,7 @@ <#include "include/html_head.ftl"> +${detectNewVersionScript?no_esc} <#include "include/html_title_app_name.ftl"><@spring.message code='register.register' /> @@ -19,6 +20,7 @@
<#include "include/html_logo.ftl"> @@ -122,6 +124,8 @@ }); $(".ui-dialog .ui-dialog-titlebar-close", dialog.widget).hide(); + + po.initSysMenu(); }) (${pageId}); diff --git a/datagear-web/src/main/resources/org/datagear/web/templates/reset_password.ftl b/datagear-web/src/main/resources/org/datagear/web/templates/reset_password.ftl index 0f49a8acd..9a685f0c8 100644 --- a/datagear-web/src/main/resources/org/datagear/web/templates/reset_password.ftl +++ b/datagear-web/src/main/resources/org/datagear/web/templates/reset_password.ftl @@ -12,6 +12,7 @@ <#include "include/html_head.ftl"> +${detectNewVersionScript?no_esc} <#if step.finalStep> @@ -23,6 +24,7 @@
<#include "include/html_logo.ftl"> @@ -144,6 +146,8 @@ }); } }); + + po.initSysMenu(); }) (${pageId});