Compare commits
No commits in common. "5e80a5ab22e7ee56ad57690dea7ed715f5878e8e" and "b27b9ff60f5194f6d46b924572f53a2fcb39ebde" have entirely different histories.
5e80a5ab22
...
b27b9ff60f
@ -8,12 +8,14 @@ import kr.lunaticbum.back.lun.model.User
|
||||
import kr.lunaticbum.back.lun.model.UserManager
|
||||
import kr.lunaticbum.back.lun.utils.LogService
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.data.annotation.AccessType
|
||||
import org.springframework.http.MediaType
|
||||
import org.springframework.http.ResponseEntity
|
||||
import org.springframework.web.bind.annotation.*
|
||||
import org.springframework.web.reactive.function.client.WebClient
|
||||
import org.springframework.web.servlet.ModelAndView
|
||||
import java.util.*
|
||||
import org.springframework.web.servlet.function.ServerResponse
|
||||
import reactor.core.publisher.Mono
|
||||
|
||||
|
||||
@RestController
|
||||
@ -32,13 +34,8 @@ class UserController {
|
||||
@GetMapping("/join")
|
||||
fun hello(httpServletRequest: HttpServletRequest): ModelAndView {
|
||||
logService.log("onJoin")
|
||||
val vm = ModelAndView("/content/user/join")
|
||||
when(System.currentTimeMillis() % 5L) {
|
||||
0L -> vm.modelMap.put("ENC","T4")
|
||||
1L -> vm.modelMap.put("ENC","T3")
|
||||
2L -> vm.modelMap.put("ENC","T2")
|
||||
else -> vm.modelMap.put("ENC","T0")
|
||||
}
|
||||
val vm = ModelAndView()
|
||||
vm.modelMap.put("ddd","asdas")
|
||||
logService.log("${vm.toString()}")
|
||||
return vm
|
||||
}
|
||||
@ -51,9 +48,6 @@ class UserController {
|
||||
fun joinUser(httpServletRequest: HttpServletRequest, @RequestBody jsonString: String) : ResponseEntity<ResponceResult> {
|
||||
logService.log("${httpServletRequest.requestURI}")
|
||||
logService.log(jsonString)
|
||||
var u : User? = null
|
||||
val decodedBytes: ByteArray = Base64.getDecoder().decode(jsonString)
|
||||
String(decodedBytes)?.let { jsonString ->
|
||||
val reqString = jsonString.split("_||L_")
|
||||
var nb = arrayListOf<String>()
|
||||
(reqString[0].replace("_||L_","").split("")).toList().let {
|
||||
@ -81,10 +75,10 @@ class UserController {
|
||||
}
|
||||
logService.log(fullData.joinToString(""))
|
||||
var user = Gson().fromJson(fullData.joinToString(""), User::class.java)
|
||||
var u : User? = null
|
||||
if (user.checkValid()) {
|
||||
u = userManager.save(user).block()
|
||||
}
|
||||
}
|
||||
val responce = ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(ResponceResult().apply {
|
||||
resultCode = if (u != null) 0 else 8245
|
||||
resultMsg = if (u != null) "OK" else "User Insert Fail"
|
||||
|
||||
@ -25,12 +25,6 @@ spring.data.mongodb.authentication-database=admin
|
||||
spring.data.mongodb.database=l
|
||||
spring.thymeleaf.prefix=classpath:/templates/
|
||||
spring.thymeleaf.suffix=.html
|
||||
# ?? ???? ??? ?? ? ?? ????.
|
||||
spring.devtools.livereload.enabled=true
|
||||
# thymeleaf? ?? ??? ??? ???. cache=false ??(???? true)
|
||||
spring.thymeleaf.cache=false
|
||||
# templates ????? ??? ??? ??? ??, ??? ??? ?????.
|
||||
spring.thymeleaf.check-template-location=true
|
||||
telegram.bot.key=1
|
||||
telegram.my.id=2
|
||||
telegram.target.id=3
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
body, html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.header {
|
||||
background-color: Gray;
|
||||
height: 20%
|
||||
}
|
||||
|
||||
.content {
|
||||
height:60%;
|
||||
}
|
||||
|
||||
.footer {
|
||||
background-color: yellow;
|
||||
height: 20%
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout/default_layout}">
|
||||
|
||||
<th:block layout:fragment="head">
|
||||
<title>Spring Boot</title>
|
||||
|
||||
<!--/* css */-->
|
||||
<link th:href="@{/css/common.css}" rel="stylesheet" />
|
||||
</th:block>
|
||||
<body>
|
||||
<th:block layout:fragment="header" th:include="@{/fragments/header}"></th:block>
|
||||
|
||||
<div layout:fragment="content" class="content">
|
||||
<h2>This is Content</h2>
|
||||
</div>
|
||||
|
||||
<th:block layout:fragment="footer" th:include="@{/fragments/footer}"></th:block>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,48 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
layout:decorate="~{layout/default_layout}">
|
||||
|
||||
<th:block layout:fragment="head">
|
||||
<title>Spring Boot</title>
|
||||
|
||||
<!--/* css */-->
|
||||
<link th:href="@{/css/common.css}" rel="stylesheet" />
|
||||
</th:block>
|
||||
<body>
|
||||
<th:block layout:fragment="header" th:include="@{/fragments/header}"></th:block>
|
||||
|
||||
<div layout:fragment="content" class="content">
|
||||
<table>
|
||||
<tr>
|
||||
<td><h2>회원가입</h2></td>
|
||||
</tr>
|
||||
<tr><td>아이디</td></tr>
|
||||
<tr><td><input id="user_id" type="text" class="text"></td></tr>
|
||||
<tr><td>비밀번호</td></tr>
|
||||
<tr><td><input id="user_pw" type="password" class="text"></td></tr>
|
||||
<tr><td>비밀번호 확인</td></tr>
|
||||
<tr><td><input id="user_pw_check" type="password" class="text"></td></tr>
|
||||
<tr><td>이름</td></tr>
|
||||
<tr><td><input id="user_name" type="text" class="text"></td></tr>
|
||||
<tr><td>생년월일</td></tr>
|
||||
<tr><td><input id="user_birth" type="date" class="text"></td></tr>
|
||||
<tr><td>이메일</td></tr>
|
||||
<tr>
|
||||
<td><input id="user_email" type="text" class="email"> @
|
||||
<select>
|
||||
<option>naver.com</option>
|
||||
<option>gmail.com</option>
|
||||
<option>daum.net</option>
|
||||
<option>nate.com</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td><input type="submit" value="가입하기" class="btn" onclick="userJoin()"></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<th:block layout:fragment="footer" th:include="@{/fragments/footer}"></th:block>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,5 +0,0 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
|
||||
<div class="footer">
|
||||
<h2>Footer</h2>
|
||||
</div>
|
||||
</html>
|
||||
@ -1,5 +0,0 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
|
||||
<div class="header">
|
||||
<h2>Header</h2>
|
||||
</div>
|
||||
</html>
|
||||
@ -1,15 +0,0 @@
|
||||
<html lang="ko"
|
||||
xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
|
||||
|
||||
<!--/* 이곳에 각 view가 위치합니다. */-->
|
||||
<th:block layout:fragment="head"></th:block>
|
||||
|
||||
<div>
|
||||
<div layout:fragment="header"></div>
|
||||
|
||||
<div layout:fragment="content"></div>
|
||||
|
||||
<div layout:fragment="footer"></div>
|
||||
</div>
|
||||
</html>
|
||||
155
src/main/resources/templates/user/join.html
Normal file
155
src/main/resources/templates/user/join.html
Normal file
@ -0,0 +1,155 @@
|
||||
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Join</title>
|
||||
<style>
|
||||
table {
|
||||
width: 280px;
|
||||
height: 850px;
|
||||
margin: auto;
|
||||
|
||||
}
|
||||
.email {
|
||||
width: 127px;
|
||||
height: 32px;
|
||||
font-size: 15px;
|
||||
border: 0;
|
||||
border-color: lightgray;
|
||||
border-radius: 15px;
|
||||
outline: none;
|
||||
padding-left: 10px;
|
||||
background-color: rgb(233,233,233);
|
||||
}
|
||||
.text {
|
||||
width: 250px;
|
||||
height: 32px;
|
||||
font-size: 15px;
|
||||
border: 0;
|
||||
border-radius: 15px;
|
||||
outline: none;
|
||||
padding-left: 10px;
|
||||
background-color: rgb(233,233,233);
|
||||
}
|
||||
select {
|
||||
width: 100px;
|
||||
height: 32px;
|
||||
font-size: 15px;
|
||||
border: 1px;
|
||||
border-color: lightgray;
|
||||
border-radius: 15px;
|
||||
outline: none;
|
||||
padding-left: 10px;
|
||||
}
|
||||
.btn {
|
||||
width: 262px;
|
||||
height: 32px;
|
||||
font-size: 15px;
|
||||
border: 0;
|
||||
border-radius: 15px;
|
||||
outline: none;
|
||||
padding-left: 10px;
|
||||
background-color: rgb(164, 199, 255);
|
||||
}
|
||||
.btn:active {
|
||||
width: 262px;
|
||||
height: 32px;
|
||||
font-size: 15px;
|
||||
border: 0;
|
||||
border-radius: 15px;
|
||||
outline: none;
|
||||
padding-left: 10px;
|
||||
background-color: rgb(61, 135, 255);
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
function getDivder() {
|
||||
return "_||L_"
|
||||
}
|
||||
function mergeData(a , b) {
|
||||
return a.join("") + getDivder() + b.join("")
|
||||
}
|
||||
|
||||
function userJoin() {
|
||||
var httpRequest;
|
||||
var user_id = document.getElementById("user_id").value;
|
||||
var user_pw = document.getElementById("user_pw").value;
|
||||
var user_pw_check = document.getElementById("user_pw_check").value;
|
||||
if (user_pw === user_pw_check) {
|
||||
var user_email = document.getElementById("user_email").value;
|
||||
var user_birth = document.getElementById("user_birth").value;
|
||||
var user_name = document.getElementById("user_name").value;
|
||||
|
||||
/* 통신에 사용 될 XMLHttpRequest 객체 정의 */
|
||||
httpRequest = new XMLHttpRequest();
|
||||
/* httpRequest의 readyState가 변화했을때 함수 실행 */
|
||||
httpRequest.onreadystatechange = () => {
|
||||
/* readyState가 Done이고 응답 값이 200일 때, 받아온 response로 name과 age를 그려줌 */
|
||||
if (httpRequest.readyState === XMLHttpRequest.DONE) {
|
||||
if (httpRequest.status === 200) {
|
||||
var result = httpRequest.response;
|
||||
console.log(result)
|
||||
alert('Request OK!' + result);
|
||||
// document.getElementById("name").innerText = result.name;
|
||||
// document.getElementById("age").innerText = result.age;
|
||||
} else {
|
||||
alert(httpRequest.response);
|
||||
alert('Request Error!');
|
||||
}
|
||||
}
|
||||
};
|
||||
/* Get 방식으로 name 파라미터와 함께 요청 */
|
||||
httpRequest.open('POST', 'joinUser.ajax', true);
|
||||
httpRequest.setRequestHeader("Content-Type", "text/plain");
|
||||
|
||||
let data = {
|
||||
'user_id': user_id,
|
||||
'user_pw': user_pw,
|
||||
'user_pw_check': user_pw_check,
|
||||
'user_email': user_email,
|
||||
'user_birth': user_birth,
|
||||
'user_name': user_name
|
||||
}
|
||||
var odd = []
|
||||
var even = []
|
||||
var dataStr = JSON.stringify(data)
|
||||
var src = dataStr.split("")
|
||||
src.forEach(function (s,i,a) {if (i % 2 === 0) {even.push(s)} else {odd.push(s)}})
|
||||
httpRequest.send(mergeData(even.reverse(),odd.reverse()));
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><h2>회원가입</h2></td>
|
||||
</tr>
|
||||
<tr><td>아이디</td></tr>
|
||||
<tr><td><input id="user_id" type="text" class="text"></td></tr>
|
||||
<tr><td>비밀번호</td></tr>
|
||||
<tr><td><input id="user_pw" type="password" class="text"></td></tr>
|
||||
<tr><td>비밀번호 확인</td></tr>
|
||||
<tr><td><input id="user_pw_check" type="password" class="text"></td></tr>
|
||||
<tr><td>이름</td></tr>
|
||||
<tr><td><input id="user_name" type="text" class="text"></td></tr>
|
||||
<tr><td>생년월일</td></tr>
|
||||
<tr><td><input id="user_birth" type="date" class="text"></td></tr>
|
||||
<tr><td>이메일</td></tr>
|
||||
<tr>
|
||||
<td><input id="user_email" type="text" class="email"> @
|
||||
<select>
|
||||
<option>naver.com</option>
|
||||
<option>gmail.com</option>
|
||||
<option>daum.net</option>
|
||||
<option>nate.com</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td><input type="submit" value="가입하기" class="btn" onclick="userJoin()"></td></tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user