Skip to content

Commit

Permalink
FIX : sessionid 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchoi57 committed Jan 27, 2023
1 parent b6af4b9 commit b1c4bb6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main/java/bejavawebserver/service/LoginService.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public class LoginService {

public static boolean isLogin(HttpSession session) {
if (session == null) return false;
return session.getAttribute(session.getId()) != null;
return session.getAttribute("user") != null;
}

public boolean isLoginSuccess(LoginForm loginForm, HttpSession session) {
User user = jdbcRepository.findUserById(loginForm.getUserId());
boolean isSuccess = Objects.equals(user.getPassword(), loginForm.getPassword());
if (isSuccess) session.setAttribute(session.getId(), user);
if (isSuccess) session.setAttribute("user", user);
return isSuccess;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bejavawebserver/service/LogoutService.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
@Service
public class LogoutService {
public void removeSession(HttpSession session) {
session.removeAttribute(session.getId());
session.removeAttribute("user");
}
}

0 comments on commit b1c4bb6

Please sign in to comment.