mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
로그인 기능 연결
This commit is contained in:
@@ -38,9 +38,7 @@ public class AuthAspect {
|
||||
HttpServletResponse response = sa.getResponse();
|
||||
HttpSession session = request.getSession();
|
||||
HashMap<String, AuthData> auth = (HashMap<String, AuthData>) session.getAttribute("authSession");
|
||||
if(auth == null){
|
||||
auth = test(request);
|
||||
}
|
||||
|
||||
String targetController = joinPoint.getTarget().toString().toLowerCase();
|
||||
String[] list = targetController.split("\\.");
|
||||
|
||||
|
||||
@@ -4,26 +4,54 @@ import com.no1.wms.account.AccountDto;
|
||||
import com.no1.wms.account.AccountService;
|
||||
import com.no1.wms.authority.AuthorityDto;
|
||||
import com.no1.wms.authority.AuthorityService;
|
||||
import com.no1.wms.in.InDto;
|
||||
import com.no1.wms.in.InService;
|
||||
import com.no1.wms.stock.StockService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
StockService service;
|
||||
|
||||
@Autowired
|
||||
InService inService;
|
||||
@GetMapping("/")
|
||||
public ModelAndView base(HttpServletRequest request, ModelAndView mav){
|
||||
public String mainPage(@RequestParam(name = "searchn2", defaultValue = "0") int searchn2,
|
||||
@RequestParam(name = "search2", defaultValue = "") String search2,
|
||||
@RequestParam(name = "p2", defaultValue = "1") int p2, Model m) {
|
||||
|
||||
mav.addObject("userData", request.getSession().getAttribute("userData"));
|
||||
int perPage2 = 5; // 한 페이지에 보일 글의 갯수
|
||||
int startRow2 = (p2 - 1) * perPage2;
|
||||
|
||||
mav.setViewName("redirect:/main");
|
||||
List<Map<String, Object>> dto2 = service.list2(searchn2, search2, startRow2 ,perPage2);
|
||||
m.addAttribute("slist2", dto2);
|
||||
System.out.println("리스트 확인 : : " + dto2);
|
||||
|
||||
return mav;
|
||||
|
||||
Date today = new Date();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String formattedDate = dateFormat.format(today);
|
||||
|
||||
List<InDto> dto = inService.inListMain(formattedDate);
|
||||
m.addAttribute("inDto", dto);
|
||||
|
||||
return "base/main";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.no1.wms.base;
|
||||
|
||||
import com.no1.wms.in.InDto;
|
||||
import com.no1.wms.in.InService;
|
||||
import com.no1.wms.stock.StockService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class MainPageController {
|
||||
|
||||
@Autowired
|
||||
StockService service;
|
||||
|
||||
@Autowired
|
||||
InService inService;
|
||||
|
||||
@GetMapping("/main")
|
||||
public String mainPage(@RequestParam(name = "searchn2", defaultValue = "0") int searchn2,
|
||||
@RequestParam(name = "search2", defaultValue = "") String search2,
|
||||
@RequestParam(name = "p2", defaultValue = "1") int p2, Model m) {
|
||||
|
||||
int perPage2 = 5; // 한 페이지에 보일 글의 갯수
|
||||
int startRow2 = (p2 - 1) * perPage2;
|
||||
|
||||
List<Map<String, Object>> dto2 = service.list2(searchn2, search2, startRow2 ,perPage2);
|
||||
m.addAttribute("slist2", dto2);
|
||||
System.out.println("리스트 확인 : : " + dto2);
|
||||
|
||||
|
||||
Date today = new Date();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String formattedDate = dateFormat.format(today);
|
||||
|
||||
List<InDto> dto = inService.inListMain(formattedDate);
|
||||
m.addAttribute("inDto", dto);
|
||||
|
||||
return "base/main";
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,16 @@ public class LoginController {
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/logout")
|
||||
public String logout(AccountDto data, AuthorityDto authDto, Gson gson, HttpServletRequest request){
|
||||
HttpSession session = request.getSession();
|
||||
session.invalidate();
|
||||
|
||||
return "redirect:/";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@PostMapping("/login/check_password")
|
||||
|
||||
|
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 58 KiB |
BIN
src/main/resources/static/img/mypage/profile/defaultimg.jpg
Normal file
BIN
src/main/resources/static/img/mypage/profile/defaultimg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
@@ -8,13 +8,19 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link d-flex align-items-center gap-2" href="/mypage">
|
||||
<div class="text-center">
|
||||
<img class="img-user" src="https://academy.ilwoo.org/data/file/reference/3531300541_J1gHPmC6_479f762b4825515abc781b3a616929d8949ea2c5.jpg" alt="유저 이미지">
|
||||
|
||||
<img alt ="" class="img-user" src="/resources/static/img/mypage/profile/${userData.id}.jpg" onerror="this.onerror=null; this.src='https://academy.ilwoo.org/data/file/reference/3531300541_J1gHPmC6_479f762b4825515abc781b3a616929d8949ea2c5.jpg'">
|
||||
<br>
|
||||
<p class="user-name">${userData.name}</p>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<hr class="my-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link d-flex align-items-center gap-2" href="/">
|
||||
<i data-feather="list"></i>게시판
|
||||
</a>
|
||||
</li>
|
||||
<c:if test="${authSession.account.read}">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link d-flex align-items-center gap-2" href="/account/list">
|
||||
@@ -99,13 +105,11 @@
|
||||
</a>
|
||||
</li>
|
||||
</c:if>
|
||||
<c:if test="${authSession.board.read}">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link d-flex align-items-center gap-2" href="/board/list">
|
||||
<i data-feather="list"></i>게시판
|
||||
<a class="nav-link d-flex align-items-center gap-2" href="/logout">
|
||||
로그아웃
|
||||
</a>
|
||||
</li>
|
||||
</c:if>
|
||||
</ul>
|
||||
|
||||
<hr class="my-3">
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
}
|
||||
</script>
|
||||
<main class="form-signin">
|
||||
<img class="mb-4" src="/docs/5.0/assets/brand/bootstrap-logo.svg" alt="" width="72" height="57">
|
||||
<img class="mb-4" src="/resources/static/img/mainpage/2.png" alt="" width="200" height="200">
|
||||
<h1 class="h3 mb-3 fw-normal">Please sign in</h1>
|
||||
|
||||
<div class="form-floating">
|
||||
|
||||
Reference in New Issue
Block a user