Bläddra i källkod

Merge remote-tracking branch 'origin/databank'

junekeunsong 4 år sedan
förälder
incheckning
581d0b8eb6

+ 29 - 0
src/main/java/com/lemon/lifecenter/controller/CenterController.java

@@ -30,6 +30,7 @@ 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.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import com.lemon.lifecenter.common.LifeCenterConfigVO;
@@ -252,6 +253,34 @@ public class CenterController extends LifeCenterController {
         return mv;
     }
     
+    @RequestMapping( value="/passwordReset", method = RequestMethod.POST )
+    @ResponseBody
+    public boolean passwordReset(
+            @RequestParam( value="staffId", required = true ) String id,
+            @RequestParam( value="type", required = true ) String type) throws Exception {
+
+        boolean result = false;
+        String pw = "";
+        StaffDTO dto = new StaffDTO();
+        dto.setId(id);
+        if (type.equals("staff")) {
+//            pw = LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, config.staffResetPw);
+            pw = LifeCenterFunction.sha256Encrypt(config.staffResetPw);
+        } else {
+//            pw = LifeCenterFunction.aesEncrypt(config.aesKey, config.IV, config.centerResetPw);
+            pw = LifeCenterFunction.sha256Encrypt(config.centerResetPw);
+        }
+        dto.setPassword(pw);
+        
+        int rts = memberService.updateMemberPwReset(dto);
+        
+        if (rts == 1) {
+            result = true;
+        }
+        
+        return result;
+    }
+    
     @RequestMapping( value="/excel", method=RequestMethod.POST )
     public void getCenterList(HttpServletRequest request,HttpServletResponse response) {
         CenterInfoDTO dto = new CenterInfoDTO();

+ 1 - 1
src/main/webapp/WEB-INF/jsp/center/info.jsp

@@ -11,7 +11,7 @@ function pwReset() {
         txt : "비밀번호를 초기화 하시겠습니까?", 
         callBack : function( result ){
             if( result ){
-                getAjax("/staff/passwordReset", $("#hiddenForm").serialize(), function ( result ) {
+                getAjax("/center/passwordReset", $("#hiddenForm").serialize(), function ( result ) {
                     console.log( result );
                     if (result === true) {
                         alertBox({ txt :'비밀번호가 초기화 되었습니다.' });