ㅇㅇ 로그인아웃 방식 변경

This commit is contained in:
2025-08-04 16:35:49 +09:00
parent 3dcb077e2f
commit e39a7d1fd3
34 changed files with 574 additions and 458 deletions
+3 -1
View File
@@ -86,6 +86,8 @@ spring.ai.vectorstore.qdrant.collection-name=blama_vectors
spring.ai.ollama.embedding.enabled=true
resource.handler=.
resource.location=.
server.forward-headers-strategy=framework
#>>>>>>> ab915d0a416c69708f1df1ad76d7a14c779c1f59
+28
View File
@@ -168,3 +168,31 @@ footer {
min-height: 5vh;
position: relative;
}
#rememberMe {
width: 20px;
height: 20px;
background-color: lightblue; /* 체크박스 배경색 */
border: 2px solid blue; /* 테두리 색 */
appearance: none; /* 기본 OS 스타일 제거 */
-webkit-appearance: none;
-moz-appearance: none;
cursor: pointer;
position: relative;
}
#rememberMe:checked {
background-color: blue;
}
#rememberMe:checked::after {
content: "";
position: absolute;
top: 3px;
left: 7px;
width: 5px;
height: 10px;
border: solid white;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
}
+1 -1
View File
@@ -31,7 +31,7 @@ function onclickWrite(type, keyword, html) {
baseData.firstPostLat = encodeURIComponent(currentLat)
baseData.firstPostLon = encodeURIComponent(currentLon)
}
let uploadUrl = getMainPath() + "/blog/post.ajax";
let uploadUrl = getMainPath() + "/blog/post.bjx";
if(confirm(JSON.stringify(baseData) + "\n해당 내용으로\n유저 등록 하실??")) {
post(uploadUrl,type,JSON.stringify(baseData),keyword, function (resultData) {
alert(resultData)
+30 -14
View File
@@ -147,7 +147,7 @@ function postLogin(target,type, data, key,callBackResult) {
}
}
httpRequest.withCredentials = true
httpRequest.open('POST', target, true);
httpRequest.setRequestHeader("Content-Type", "text/plain");
var odd = []
@@ -172,15 +172,15 @@ function mainPath() {
}
function gotoWrite() {
document.location.replace(getMainPath()+"/blog/write")
document.location.replace(getMainPath()+"/blog/write.bs")
}
function gotoModify() {
document.location.replace(getMainPath()+"/blog/modify")
document.location.replace(getMainPath()+"/blog/modify.bs")
}
function gotoWhere() {
document.location.replace(getMainPath()+"/bums/where")
document.location.replace(getMainPath()+"/bums/where.bs")
}
function logout() {
@@ -191,21 +191,35 @@ function logout() {
console.log(document.cookie["JSESSIONID"])
document.cookie = "JSESSIONID=; expires=Thu, 01 Jan 1970 00:00:01 GMT;"
document.cookie = "CLEAR="+Date.now()+"";
let logOutUrl = getMainPath() + "/user/logout.ajax";
post(logOutUrl,"","","", function (resultData) {
alert("로그아웃 됨요~! 빠염~!")
document.location.replace(document.location)
})
let logOutUrl = getMainPath() + "/user/logout.bs";
alert("로그아웃 됨요~! 빠염~!")
// 동적으로 form 생성하여 POST 요청 전송
const form = document.createElement('form');
form.method = 'POST';
form.action = getMainPath() + '/user/logout.bs';
// CSRF 토큰을 meta태그 등에서 얻어서 삽입 (예: <meta name="_csrf" content="토큰값">)
const csrfToken = document.querySelector('meta[name="_csrf"]').getAttribute('content');
const csrfParam = document.querySelector('meta[name="_csrf_parameter"]').getAttribute('content');
const csrfInput = document.createElement('input');
csrfInput.type = 'hidden';
csrfInput.name = csrfParam; // 예: "_csrf"
csrfInput.value = csrfToken;
form.appendChild(csrfInput);
document.body.appendChild(form);
form.submit();
}
function gotoLogin() {
console.log(`location.port >> ${location.port}`)
location.href = getMainPath()+"/login"
location.href = getMainPath()+"/login.bs"
}
function gotoJoin() {
document.location.replace(getMainPath() + "/user/join")
document.location.replace(getMainPath() + "/user/join.bs")
}
function goToView(path,id) {
@@ -218,7 +232,7 @@ function onclickLogin(type, keyword) {
'user_id': user_id.value,
'user_pw': user_pw.value,
}
postLogin(getMainPath()+"/user/login.ajax",type,JSON.stringify(data),keyword, function (data) {
postLogin(getMainPath()+"/user/login.bjx",type,JSON.stringify(data),keyword, function (data) {
if (data.isOk) {
document.cookie = "access=" + data.token.split(";")[0]+";"
@@ -229,7 +243,7 @@ function onclickLogin(type, keyword) {
} else {
if (data.resultCode === 7100) {
if(confirm(`너 누구임 정보 없는데?!\n${data.resultMsg}[${data.resultCode}]\n가입 할래!?`)){
document.location.replace(getMainPath() + "/user/join")
document.location.replace(getMainPath() + "/user/join.bs")
}
} else {
alert(`너 누구임?!\n${data.resultMsg}[${data.resultCode}]`)
@@ -320,11 +334,13 @@ function submitLoginForm() {
// const password = document.getElementById('loginPassword').value;
let user_id = document.getElementById('loginId')
let user_pw = document.getElementById('loginPassword')
let rememberMe = document.getElementById('rememberMe')
let data = {
'user_id': user_id.value,
'user_pw': user_pw.value,
'rememberMe' : rememberMe.value,
}
postLogin(getMainPath()+"/user/login.ajax",user_pw.data,JSON.stringify(data),user_pw.data, function (data) {
postLogin(getMainPath()+"/user/login.bjx",user_pw.data,JSON.stringify(data),user_pw.data, function (data) {
closePopup()
if (data.isOk) {
document.cookie = "access=" + data.token.split(";")[0]+";"
+1 -1
View File
@@ -62,7 +62,7 @@ function onclickJoin(type, keyword) {
}
if (user_pw.value === user_pw_check.value) {
if(confirm(JSON.stringify(data) + "\n해당 내용으로\n유저 등록 하실??")) {
post("joinUser.ajax",type,JSON.stringify(data),keyword, function (resultData) {
post("joinUser.bjx",type,JSON.stringify(data),keyword, function (resultData) {
alert(resultData)
})
} else {
@@ -2,6 +2,8 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}"
>
<th:block layout:fragment="head" id="head">
@@ -86,10 +88,10 @@
</section>
<section class="wrapper style2">
<th:block th:if="${PERMISSION != 'OK'}">
<th:block sec:authorize="isAnonymous()">
<h1>권한이 없는 뎁쇼?!</h1>
</th:block>
<th:block th:if="${PERMISSION == 'OK'}">
<th:block sec:authorize="isAuthenticated()">
<div id="editor" ></div>
<div class="write_controllbox">
<div class="write_option btn-example" to="#popLayer1" onclick="openPopup(this)" ></div>
@@ -2,6 +2,7 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}">
<th:block layout:fragment="head">
<script type="text/javascript" th:src="@{/js/blog.js}"></script>
@@ -33,10 +34,10 @@
</th:block>
<th:block layout:fragment="content" id="content">
<div id="main_layer">
<th:block th:if="${PERMISSION != 'OK'}">
<th:block sec:authorize="isAnonymous()">
<h1>권한이 없는 뎁쇼?!</h1>
</th:block>
<th:block th:if="${PERMISSION == 'OK'}">
<th:block sec:authorize="isAuthenticated()">
<div class="post_layer">
<th:block class="posts_layer" id="posts" th:each="posts ,postsStat: ${chunkedPosts}">
<th:block class="posts_layer" th:class="${#strings.append(rowKey,postsStat.index)}" th:each="post, postStast : ${posts}">
@@ -2,6 +2,7 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}"
>
<th:block layout:fragment="head">
@@ -2,6 +2,7 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}"
>
<th:block layout:fragment="head">
@@ -38,13 +39,13 @@
<th:block layout:fragment="content" id="content">
<section class="wrapper style2">
<div class="container" th:if="${PERMISSION == 'OK'}" onclick="loadEditor()">
<div class="container" sec:authorize="isAuthenticated()" onclick="loadEditor()">
<header class="major">
<h2 id="title_layer" th:text="${srcPost.title}">A gigantic heading you can use for whatever</h2>
<p th:text="${#temporals.format(T(java.time.Instant).ofEpochMilli(srcPost.writeTime).atZone(T(java.time.ZoneId).systemDefault()).toLocalDateTime(), 'yyyy-MM-dd HH:mm:ss')}"></p>
</header>
</div>
<div class="container" th:if="${PERMISSION != 'OK'}" onclick="openLoginPopup('login')">
<div class="container" sec:authorize="isAnonymous()" onclick="openLoginPopup('login')">
<header class="major">
<h2 id="title_layer" th:text="${srcPost.title}">A gigantic heading you can use for whatever</h2>
<p th:text="${#temporals.format(T(java.time.Instant).ofEpochMilli(srcPost.writeTime).atZone(T(java.time.ZoneId).systemDefault()).toLocalDateTime(), 'yyyy-MM-dd HH:mm:ss')}"></p>
@@ -2,6 +2,7 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}"
>
<th:block layout:fragment="head" id="head">
@@ -100,10 +101,10 @@
</th:block>
<th:block layout:fragment="content" id="content">
<div id="main_layer">
<th:block th:if="${PERMISSION != 'OK'}">
<th:block sec:authorize="isAnonymous()">
<h1>권한이 없는 뎁쇼?!</h1>
</th:block>
<th:block th:if="${PERMISSION == 'OK'}">
<th:block sec:authorize="isAuthenticated()">
<div class="layer">
<input id="title_field" class="write_option" />
</div>
@@ -2,6 +2,7 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}">
<th:block layout:fragment="head">
<script type="text/javascript" th:src="@{/js/blog.js}"></script>
@@ -10,7 +11,7 @@
<script type="text/javascript" th:src="@{/js/test.js}"></script>
<link th:href="@{/css/toast-ui-dark.css}" rel="stylesheet" />
<script th:inline="javascript">
document.addEventListener("DOMContentLoaded", onLoaded);
// document.addEventListener("DOMContentLoaded", onLoaded);
function goToViewer(item) {
let uploadUrl = getMainPath() + "/blog/viewer/"+item.attributes['data'].value;
location.href = uploadUrl
@@ -73,12 +74,12 @@
</div>
</section>
<section class="col-4 col-12-narrower">
<div class="box highlight" th:if="${PERMISSION == 'OK'}" onclick=gotoWrite()>
<div class="box highlight" sec:authorize="isAuthenticated()" onclick=gotoWrite()>
<i class="icon solid major fa-pencil-alt"></i>
<h3>글쓰기[Writing]</h3>
<p>오직 주인장 만의 권한 임요. 그냥 내가 쓰기 편하게 여기 놔둔 메뉴임. 님들은 못씀요.<br>[Only the owner has the authority. This is just a menu that I put here for my convenience. You can't use it.]</p>
</div>
<div class="box highlight" th:if="${PERMISSION != 'OK'}" onclick="openLoginPopup('login')">
<div class="box highlight" sec:authorize="isAnonymous()" onclick="openLoginPopup('login')">
<i class="icon solid major fa-pencil-alt"></i>
<h3>글쓰기[Writing]</h3>
<p>오직 주인장 만의 권한 임요. 그냥 내가 쓰기 편하게 여기 놔둔 메뉴임. 님들은 못씀요.<br>[Only the owner has the authority. This is just a menu that I put here for my convenience. You can't use it.]</p>
@@ -2,6 +2,7 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}">
<th:block layout:fragment="head">
<script type="text/javascript" th:src="@{/js/blog.js}"></script>
@@ -2,6 +2,8 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}"
>
<th:block layout:fragment="head">
@@ -2,6 +2,7 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}">
<th:block layout:fragment="head">
<script type="text/javascript" th:src="@{/js/blog.js}"></script>
@@ -2,6 +2,7 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}">
<th:block layout:fragment="head">
<link th:href="@{/css/private.css}" rel="stylesheet" />
@@ -2,6 +2,7 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}">
<th:block layout:fragment="head">
<script type="text/javascript" th:src="@{/js/blog.js}"></script>
@@ -2,6 +2,7 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}">
<th:block layout:fragment="head">
<script type="text/javascript" th:src="@{/js/blog.js}"></script>
@@ -2,6 +2,7 @@
<html
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}"
>
<th:block layout:fragment="head" id="head">
@@ -2,6 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
layout:decorate="~{layout/default_layout}">
<head>
@@ -1,39 +1,54 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html">
<html
xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/html"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<th:block th:fragment="header">
<div id="header">
<!-- Logo -->
<h1><a th:href="@{/}" id="logo">BUM ' <em>sPace</em></a></h1>
<th:block sec:authorize="isAuthenticated()">
<span style="margin-left:20px;">환영합니다, <b sec:authentication="name"></b>님!</span>
</th:block>
<!-- Nav -->
<nav id="nav">
<ul>
<li id="menu_home" ><a th:href="@{/}">Home</a></li>
<li id="menu_posts"><a href="blog/posts">Posts</a></li>
<li id="menu_sec"><a href="left-sidebar">Left Sidebar</a></li>
<li id="menu_thr"><a href="right-sidebar">Right Sidebar</a></li>
<li id="menu_four"><a href="two-sidebar">Two Sidebar</a></li>
<!-- <li id="menu_sec"><a href="left-sidebar">Left Sidebar</a></li>-->
<!-- <li id="menu_thr"><a href="right-sidebar">Right Sidebar</a></li>-->
<!-- <li id="menu_four"><a href="two-sidebar">Two Sidebar</a></li>-->
<li id="menu_drop">
<a href="#">About</a>
<ul>
<li><a href="#">Lorem dolor</a></li>
<li><a href="javascript:gotoWhere()">bums's where</a></li>
<li><a href="#">Magna phasellus</a></li>
<li><a href="#">Etiam sed tempus</a></li>
<li>
<a href="#">Submenu</a>
<ul>
<li><a href="#">Lorem dolor</a></li>
<th:block sec:authorize="isAuthenticated()">
<li><a href="javascript:gotoWrite()">글쓰기</a></li>
<li><a href="javascript:gotoModify()">수정하기</a></li>
</th:block>
<li><a href="#">Phasellus magna</a></li>
<li><a href="#">Magna phasellus</a></li>
<li><a href="#">Etiam nisl</a></li>
<li><a href="#">Veroeros feugiat</a></li>
<!-- <li><a href="#">Magna phasellus</a></li>-->
<!-- <li><a href="#">Etiam nisl</a></li>-->
<!-- <li><a href="#">Veroeros feugiat</a></li>-->
</ul>
</li>
<li><a th:href="@{/licenses}">Licenses</a></li>
</ul>
</li>
<th:block sec:authorize="!isAuthenticated()">
<li id="menu_login" ><a href="javascript:openLoginPopup('login')">LOGIN</a></li>
</th:block>
<th:block sec:authorize="isAuthenticated()">
<li>
<a href="javascript:logout()" style="margin-left:10px;">로그아웃</a>
<li>
</th:block>
</ul>
</nav>
@@ -13,5 +13,7 @@
<link rel="stylesheet" href="assets/css/main.css" />
<script async th:src="@{https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-9504446465764716}" crossorigin="anonymous"></script>
<script type="text/javascript" th:src="@{/js/common.js}"></script>
<meta name="_csrf" th:content="${_csrf.token}"/>
<meta name="_csrf_parameter" th:content="${_csrf.parameterName}"/>
</th:block>
</html>
@@ -2,6 +2,7 @@
<html lagn="ko"
xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
xmlns="http://www.w3.org/1999/html">
<head>
<base th:href="@{/}" />
@@ -20,12 +21,47 @@
<th:block th:replace="~{fragments/footer :: footer}"></th:block>
</div>
<div id="overlay" class="login_overlay">
<style>
.custom-checkbox {
display: none; /* 실제 체크박스 숨김 */
}
.custom-label {
display: inline-block;
width: 20px;
height: 20px;
border: 2px solid #555;
cursor: pointer;
vertical-align: middle;
position: relative;
}
.custom-checkbox:checked + .custom-label {
background-color: #007bff;
border-color: #007bff;
}
.custom-checkbox:checked + .custom-label::after {
content: '';
position: absolute;
top: 3px;
left: 7px;
width: 5px;
height: 10px;
border: solid white;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
}
</style>
<div id="popup" class="login_popup">
<div id="loginForm" class="login_form">
<h2>로그인</h2>
<form id="loginFormElement" onsubmit="return false;">
<input type="text" th:data="${enc}" id="loginId" placeholder="아이디" required>
<input type="password" th:data="${type}" id="loginPassword" placeholder="비밀번호" required>
<input type="text" th:data="${enc}" id="loginId" placeholder="아이디" required/>
<input type="password" th:data="${type}" id="loginPassword" placeholder="비밀번호" required/>
<input type="checkbox" id="rememberMe" class="custom-checkbox"/>
<label for="rememberMe" class="custom-label"></label>
<span>자동로그인</span>
<button type="submit" class="button">로그인</button>
</form>
</div>