|
@@ -1,15 +1,29 @@
|
|
|
package com.lemon.lifecenter.controller;
|
|
|
|
|
|
+import org.json.JSONObject;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
+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.ResponseBody;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
+import com.lemon.lifecenter.common.LifeCenterConfigVO;
|
|
|
import com.lemon.lifecenter.common.LifeCenterController;
|
|
|
+import com.lemon.lifecenter.common.LifeCenterFunction;
|
|
|
+import com.lemon.lifecenter.dto.LoginDTO;
|
|
|
+import com.lemon.lifecenter.service.LoginService;
|
|
|
|
|
|
@Controller
|
|
|
@RequestMapping("/login")
|
|
|
public class LoginController extends LifeCenterController {
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ LifeCenterConfigVO config;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ LoginService loginService;
|
|
|
+
|
|
|
@RequestMapping("/admin")
|
|
|
public ModelAndView adminLogin() {
|
|
|
ModelAndView mv = setMV("login/admin");
|
|
@@ -23,4 +37,43 @@ public class LoginController extends LifeCenterController {
|
|
|
|
|
|
return mv;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping( value="/check", method = RequestMethod.POST )
|
|
|
+ @ResponseBody
|
|
|
+ public String staffLoginCheck( @ModelAttribute("dto") final LoginDTO dto ) throws Exception {
|
|
|
+ String resultCode = "";
|
|
|
+ System.out.println( "ID : " + dto.getId() );
|
|
|
+ System.out.println( "PASSWROD : " + dto.getPassword() );
|
|
|
+
|
|
|
+ String encPass = LifeCenterFunction.aesEncrypt( config.aesKey, config.IV, dto.getPassword() );
|
|
|
+ System.out.println( "encPass: " + encPass );
|
|
|
+ dto.setPassword( encPass );
|
|
|
+ System.out.println( "dto.getPassword() : " + dto.getPassword() );
|
|
|
+ int total = loginService.selectMemberCount( dto );
|
|
|
+
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+
|
|
|
+ if( total == 0 ) {
|
|
|
+ // 로그인 failCount ++
|
|
|
+ resultCode = "01";
|
|
|
+ } else {
|
|
|
+ LoginDTO memberData = loginService.selectMemberData( dto );
|
|
|
+
|
|
|
+ if( memberData.getUseYn().toUpperCase().equals( "N" ) ) {
|
|
|
+ // 사용이 중지된 계정
|
|
|
+ resultCode = "02";
|
|
|
+
|
|
|
+ } else {
|
|
|
+ // 로그인 성공
|
|
|
+ resultCode = "success";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ json.put( "code", resultCode );
|
|
|
+
|
|
|
+ System.out.println( "JSON : " + json );
|
|
|
+
|
|
|
+ return json.toString();
|
|
|
+ }
|
|
|
}
|