SNS 로그인 카카오,구글 수정 완료
This commit is contained in:
parent
a8255fd739
commit
0fc3290647
6
pom.xml
6
pom.xml
@ -342,13 +342,15 @@
|
||||
<dependency>
|
||||
<groupId>com.github.scribejava</groupId>
|
||||
<artifactId>scribejava-apis</artifactId>
|
||||
<version>5.6.0</version>
|
||||
<!-- <version>5.6.0</version> -->
|
||||
<version>8.3.1</version>
|
||||
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.scribejava</groupId>
|
||||
<artifactId>scribejava-core</artifactId>
|
||||
<version>5.6.0</version>
|
||||
<version>8.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@ -1,11 +1,27 @@
|
||||
package egovframework.com.ext.oauth.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.ResponseErrorHandler;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.github.scribejava.core.builder.ScopeBuilder;
|
||||
import com.github.scribejava.core.builder.ServiceBuilder;
|
||||
import com.github.scribejava.core.model.OAuth2AccessToken;
|
||||
import com.github.scribejava.core.model.OAuthRequest;
|
||||
@ -13,6 +29,7 @@ import com.github.scribejava.core.model.Response;
|
||||
import com.github.scribejava.core.model.Verb;
|
||||
import com.github.scribejava.core.oauth.OAuth20Service;
|
||||
|
||||
import nlib.cmm.snslogin.GoogleOAuthResponse;
|
||||
import nlib.user.service.LoginService;
|
||||
import nlib.util.StringUtil;
|
||||
|
||||
@ -23,12 +40,30 @@ public class OAuthLogin {
|
||||
|
||||
|
||||
public OAuthLogin(OAuthVO oauthVO) {
|
||||
ScopeBuilder scope=new ScopeBuilder();
|
||||
scope.withScope("profile");
|
||||
scope.withScope("openid");
|
||||
scope.withScope("email");
|
||||
scope.withScope("https://www.googleapis.com/auth/user.phonenumbers.read");
|
||||
scope.withScope("https://www.googleapis.com/auth/user.birthday.read");
|
||||
|
||||
if(oauthVO.getService().equals("google"))
|
||||
{
|
||||
this.oauthService = new ServiceBuilder(oauthVO.getClientId())
|
||||
.apiSecret(oauthVO.getClientSecret())
|
||||
.callback(oauthVO.getRedirectUrl())
|
||||
.scope("profile")
|
||||
.defaultScope(scope)
|
||||
//.scope("profile")
|
||||
.build(oauthVO.getApi20Instance());
|
||||
}else if(oauthVO.getService().equals("kakao") || oauthVO.getService().equals("naver"))
|
||||
{
|
||||
this.oauthService = new ServiceBuilder(oauthVO.getClientId())
|
||||
.apiSecret(oauthVO.getClientSecret())
|
||||
.callback(oauthVO.getRedirectUrl())
|
||||
//.scope("profile")
|
||||
.build(oauthVO.getApi20Instance());
|
||||
}
|
||||
|
||||
|
||||
this.oauthVO = oauthVO;
|
||||
}
|
||||
@ -66,25 +101,36 @@ public class OAuthLogin {
|
||||
user.setSnsId(resNode.get("id").asText());
|
||||
|
||||
// 사용자로그인ID (메일형식) : 네이버 계정 제공하지 않으므로 연락처 이메일을 기본 메일 계정으로 설정
|
||||
user.setLoginUserId(resNode.get("email").asText());
|
||||
|
||||
// 사용자명 (예: 홍길동)
|
||||
user.setName(resNode.get("name").asText());
|
||||
if (resNode.has("email")) {
|
||||
user.setLoginUserId(StringUtil.getString(resNode.get("email").asText(), ""));
|
||||
|
||||
// 메일주소
|
||||
user.setEmail(resNode.get("email").asText());
|
||||
user.setEmail(StringUtil.getString(resNode.get("email").asText(), ""));
|
||||
}
|
||||
|
||||
// 사용자명 (예: 홍길동)
|
||||
if (resNode.has("name")) {
|
||||
user.setName(StringUtil.getString(resNode.get("name").asText(), ""));
|
||||
}
|
||||
|
||||
// 생년월일
|
||||
String birthday = StringUtil.getString(resNode.get("birthday").asText(), "0000");
|
||||
String birthyear = StringUtil.getString(resNode.get("birthyear").asText(), "0000");
|
||||
String birthday ="0000";
|
||||
String birthyear = "0000";
|
||||
if (resNode.has("birthday")) {
|
||||
birthday = StringUtil.getString(resNode.get("birthday").asText(), "0000");
|
||||
}
|
||||
if (resNode.has("birthyear")) {
|
||||
birthyear = StringUtil.getString(resNode.get("birthyear").asText(), "0000");
|
||||
}
|
||||
birthday = birthday.replaceAll("-", "");
|
||||
if(birthday.length() != 4) birthday = "0000";
|
||||
if(birthyear.length() != 4) birthyear = "0000";
|
||||
user.setBirthday(birthyear + birthday);
|
||||
|
||||
// 성별
|
||||
user.setGender(resNode.get("gender").asText());
|
||||
|
||||
if (resNode.has("gender")) {
|
||||
StringUtil.getString(resNode.get("gender").asText(), "");
|
||||
}
|
||||
// 로그인 성공
|
||||
user.setValidLogin(true);
|
||||
|
||||
@ -93,24 +139,13 @@ public class OAuthLogin {
|
||||
// 구글
|
||||
//------------------------------------
|
||||
else if (this.oauthVO.isGoogle()) {
|
||||
String id = rootNode.get("id").asText();
|
||||
user.setServiceName(OAuthConfig.GOOGLE_SERVICE_NAME);
|
||||
if (oauthVO.isGoogle())
|
||||
user.setLoginUserId(id);
|
||||
user.setNickName(rootNode.get("displayName").asText());
|
||||
JsonNode nameNode = rootNode.path("name");
|
||||
String uname = nameNode.get("familyName").asText() + nameNode.get("givenName").asText();
|
||||
user.setName(uname);
|
||||
if (rootNode.has("sub"))
|
||||
user.setSnsId(StringUtil.getString(rootNode.get("sub").asText(), ""));
|
||||
|
||||
if (rootNode.has("email"))
|
||||
user.setLoginUserId(StringUtil.getString(rootNode.get("email").asText(), ""));
|
||||
|
||||
Iterator<JsonNode> iterEmails = rootNode.path("emails").elements();
|
||||
while(iterEmails.hasNext()) {
|
||||
JsonNode emailNode = iterEmails.next();
|
||||
String type = emailNode.get("type").asText();
|
||||
if (StringUtils.equals(type, "account")) {
|
||||
user.setEmail(emailNode.get("value").asText());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//------------------------------------
|
||||
@ -118,9 +153,24 @@ public class OAuthLogin {
|
||||
//------------------------------------
|
||||
else if (this.oauthVO.isKakao()) {
|
||||
user.setServiceName(OAuthConfig.KAKAO_SERVICE_NAME);
|
||||
JsonNode resNode = rootNode.get("properties");
|
||||
user.setLoginUserId(rootNode.get("id").asText());
|
||||
user.setNickName(resNode.get("nickname").asText());
|
||||
JsonNode resNode = rootNode.get("kakao_account");
|
||||
|
||||
user.setSnsId((rootNode.get("id").asText() == null) ? "" : rootNode.get("id").asText());
|
||||
|
||||
if (resNode.has("email")) {
|
||||
user.setLoginUserId(StringUtil.getString(resNode.get("email").asText(), ""));
|
||||
user.setEmail(StringUtil.getString(resNode.get("email").asText(), ""));
|
||||
}
|
||||
if (resNode.has("gender"))
|
||||
user.setGender(StringUtil.getString(resNode.get("gender").asText(), ""));
|
||||
|
||||
if (resNode.has("birthday") || resNode.has("birthyear"))
|
||||
user.setLoginUserId((resNode.get("email").asText() == null) ? "" : resNode.get("email").asText());
|
||||
|
||||
if (resNode.has("phone_number"))
|
||||
user.setMobileNo(StringUtil.getString(resNode.get("phone_number").asText(), ""));
|
||||
|
||||
|
||||
}
|
||||
|
||||
return user;
|
||||
@ -147,5 +197,18 @@ public class OAuthLogin {
|
||||
|
||||
return url;
|
||||
}
|
||||
public class MyErrorHandler implements ResponseErrorHandler {
|
||||
@Override
|
||||
public void handleError(ClientHttpResponse response) throws IOException {
|
||||
// your error handling here
|
||||
System.out.println("dd");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasError(ClientHttpResponse response) throws IOException {
|
||||
return false;
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -245,9 +245,9 @@ public class MemberController {
|
||||
* 핸드폰 인증번호 발송
|
||||
* @exception Exception
|
||||
*/
|
||||
@RequestMapping(value="/member/phoneCertNum.ajax" , method=RequestMethod.POST)
|
||||
@RequestMapping(value="/member/mobileCertNum.ajax" , method=RequestMethod.POST)
|
||||
public @ResponseBody void phoneCertNum(HttpServletResponse response,HttpServletRequest request) throws Exception{
|
||||
String telNo = request.getParameter("telNo");
|
||||
String mobileNo = request.getParameter("mobileNo");
|
||||
|
||||
HashMap<String, Object> commandMap = new HashMap<String,Object>();
|
||||
DataApiReqVO reqVO = new DataApiReqVO();
|
||||
@ -259,7 +259,7 @@ public class MemberController {
|
||||
|
||||
reqVO.setInfo(commandMap);
|
||||
|
||||
System.out.println(telNo);
|
||||
System.out.println(mobileNo);
|
||||
System.out.println(CertNumber);
|
||||
|
||||
}
|
||||
@ -270,18 +270,18 @@ public class MemberController {
|
||||
*/
|
||||
@RequestMapping(value="/member/phoneCertNumChk.ajax" , method=RequestMethod.POST)
|
||||
public @ResponseBody String phoneCertNumChk(HttpServletResponse response,HttpServletRequest request) throws Exception{
|
||||
String phone = request.getParameter("phone");
|
||||
String phoneCertNum = request.getParameter("phoneCertNum");
|
||||
String mobileNo = request.getParameter("mobileNo");
|
||||
String mobileCertNum = request.getParameter("mobileCertNum");
|
||||
|
||||
HashMap<String, Object> commandMap = new HashMap<String,Object>();
|
||||
commandMap.put("phone", phone);
|
||||
commandMap.put("phoneCertNum", phoneCertNum);
|
||||
commandMap.put("phone", mobileNo);
|
||||
commandMap.put("phoneCertNum", mobileCertNum);
|
||||
DataApiReqVO reqVO = new DataApiReqVO();
|
||||
|
||||
reqVO.setInfo(commandMap);
|
||||
|
||||
System.out.println(phone);
|
||||
System.out.println(phoneCertNum);
|
||||
System.out.println(mobileNo);
|
||||
System.out.println(mobileCertNum);
|
||||
|
||||
return "true";
|
||||
}
|
||||
@ -392,7 +392,7 @@ public class MemberController {
|
||||
/**
|
||||
* 회원가입 SNS 구글인증
|
||||
* @exception Exception
|
||||
*/
|
||||
*//*
|
||||
@RequestMapping(value = "/member/googleCallback.do")
|
||||
public String googleCallback(@RequestParam(value = "code") String authCode, HttpSession session, Model model,
|
||||
HttpServletRequest request,RedirectAttributes rttr) throws Exception {
|
||||
@ -436,7 +436,7 @@ public class MemberController {
|
||||
|
||||
rttr.addFlashAttribute("email",userInfo.get("email"));
|
||||
return "redirect:/member/insertMemberInfoForm.do";
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 회원가입 SNS 카카오인증
|
||||
|
||||
@ -3,16 +3,15 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="nlib.user.service.impl.MemberDAO">
|
||||
<resultMap type="nlib.user.service.NlibLoginVO" id="NlibLoginVO">
|
||||
<result column="USER_ID" property="userId"/>
|
||||
<result column="MB_INFO_ID" property="mbInfoId"/>
|
||||
<result column="LOGIN_USER_ID" property="loginUserId"/>
|
||||
<result column="USER_DIV" property="userDiv"/>
|
||||
<result column="USER_NM" property="userNm"/>
|
||||
<result column="USER_PWD" property="userPwd"/>
|
||||
<result column="BIRTHDATE" property="birthdate"/>
|
||||
<result column="NAME" property="name"/>
|
||||
<result column="PASSWORD" property="password"/>
|
||||
<result column="BIRTHDAY" property="birthday"/>
|
||||
<result column="GENDER" property="gender"/>
|
||||
<result column="REG_ID" property="regId"/>
|
||||
<result column="MOD_ID" property="modId"/>
|
||||
<result column="TEL_NO" property="telNo"/>
|
||||
<result column="MOBILE_NO" property="mobileNo"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertMemberInfo" parameterType="nlib.user.service.NlibLoginVO">
|
||||
@ -21,7 +20,7 @@
|
||||
LPAD(RIGHT(MAX(USER_ID),9)+1,9,0)) FROM TMP_SM_USER;
|
||||
</selectKey>
|
||||
INSERT INTO
|
||||
TMP_SM_USER
|
||||
MB_INFO
|
||||
(USER_ID,LOGIN_USER_ID,USER_DIV,USER_NM,USER_PWD,BIRTHDATE,GENDER,TEL_NO,ZIPCODE,ADDR1,ADDR2,REG_ID,MOD_ID)
|
||||
VALUES
|
||||
(#{userId},#{loginUserId},'N',#{userNm},#{userPwd},#{birthdate},#{gender},#{telNo},#{zipcode},#{addr1},#{addr2},#{userId},#{userId})
|
||||
@ -39,7 +38,4 @@
|
||||
AND TEL_NO = #{telNo}
|
||||
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -3,16 +3,16 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="nlib.user.service.impl.UserInfoDAO">
|
||||
<resultMap type="nlib.user.service.NlibLoginVO" id="NlibLoginVO">
|
||||
<result column="USER_ID" property="userId"/>
|
||||
<result column="MB_INFO_ID" property="mbInfoId"/>
|
||||
<result column="LOGIN_USER_ID" property="loginUserId"/>
|
||||
<result column="USER_DIV" property="userDiv"/>
|
||||
<result column="USER_NM" property="userNm"/>
|
||||
<result column="USER_PWD" property="userPwd"/>
|
||||
<result column="BIRTHDATE" property="birthdate"/>
|
||||
<result column="TEL_NO" property="telNo"/>
|
||||
<result column="ZIPCODE" property="zipcode"/>
|
||||
<result column="ADDR1" property="addr1"/>
|
||||
<result column="ADDR2" property="addr2"/>
|
||||
<result column="NAME" property="name"/>
|
||||
<result column="PASSWORD" property="password"/>
|
||||
<result column="BIRTHDAY" property="birthday"/>
|
||||
<result column="MOBILE_NO" property="mobileNo"/>
|
||||
<result column="ZIP_CODE" property="zipCode"/>
|
||||
<result column="ADDRESS" property="address"/>
|
||||
<result column="ADDRESS_DETAIL" property="addressDetail"/>
|
||||
<result column="GENDER" property="gender"/>
|
||||
<result column="REG_ID" property="regId"/>
|
||||
<result column="MOD_ID" property="modId"/>
|
||||
@ -21,16 +21,7 @@
|
||||
|
||||
<select id="selectMyInfo" parameterType="nlib.user.service.NlibLoginVO" resultMap="NlibLoginVO">
|
||||
SELECT
|
||||
USER_ID
|
||||
,LOGIN_USER_ID
|
||||
,USER_NM
|
||||
,USER_PWD
|
||||
,BIRTHDATE
|
||||
,GENDER
|
||||
,TEL_NO
|
||||
,ZIPCODE
|
||||
,ADDR1
|
||||
,ADDR2
|
||||
LOGIN_USER_ID
|
||||
FROM
|
||||
TMP_SM_USER
|
||||
WHERE 1=1
|
||||
|
||||
@ -8,15 +8,15 @@
|
||||
<constructor-arg value="naver" /><!-- Service Name -->
|
||||
<constructor-arg value="jefkoYhSfrQ3TtZz5mTp" /><!-- naverClientID -->
|
||||
<constructor-arg value="E2qAGaLEaG" /><!-- naverClientSecret -->
|
||||
<constructor-arg value="http://nlib.nculture.org/nlib/login/naverCallback.do" /><!-- naverRedirectUrl -->
|
||||
<constructor-arg value="https://nlib.nculture.org/nlib/login/naver/callback.do" /><!-- naverRedirectUrl -->
|
||||
</bean>
|
||||
|
||||
<!-- GOOGLE OAuth Configuration -->
|
||||
<bean id="googleAuthVO" class="egovframework.com.ext.oauth.service.OAuthVO">
|
||||
<constructor-arg value="google" /><!-- Service Name -->
|
||||
<constructor-arg value="879126511006-jro7bld7b2epl3n5mkksp0p24k2inbpu.apps.googleusercontent.com" /><!-- googleClientID -->
|
||||
<constructor-arg value="5qAMYyDD9CkN3f38w0a8zomn" /><!-- googleClientSecret -->
|
||||
<constructor-arg value="http://nlib.nculture.org/nlib/login/googleCallback.do" /><!-- googleRedirectUrl -->
|
||||
<constructor-arg value="F6T-ZV9jibLhKtcugxPUtBlN" /><!-- googleClientSecret -->
|
||||
<constructor-arg value="https://nlib.nculture.org/nlib/login/google/callback.do" /><!-- googleRedirectUrl -->
|
||||
</bean>
|
||||
|
||||
<!-- KAKAO OAuth Configuration -->
|
||||
@ -24,7 +24,7 @@
|
||||
<constructor-arg value="kakao" /><!-- Service Name -->
|
||||
<constructor-arg value="e74d25210853313dd1fead4c6c1f06ec" /><!-- kakaoClientID -->
|
||||
<constructor-arg value="AGxiWEwu2ytIifA1AY2PoqVSrdnRZiao" /><!-- kakaoClientSecret -->
|
||||
<constructor-arg value="http://nlib.nculture.org/nlib/login/kakaoCallback.do" /><!-- kakaoRedirectUrl -->
|
||||
<constructor-arg value="https://nlib.nculture.org/nlib/login/kakao/callback.do" /><!-- kakaoRedirectUrl -->
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
@ -102,7 +102,7 @@ oauth2.client.provider.naver.user-name-attribute = response
|
||||
|
||||
# \uad6c\uae00
|
||||
oauth2.client.provider.google.name = GOOGLE
|
||||
oauth2.client.provider.google.user-info-uri = https://www.googleapis.com/plus/v1/people/me
|
||||
oauth2.client.provider.google.user-info-uri = https://openidconnect.googleapis.com/v1/userinfo
|
||||
|
||||
# \uce74\uce74\uc624
|
||||
oauth2.client.provider.kakao.name = KAKAO
|
||||
|
||||
@ -32,10 +32,10 @@
|
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
|
||||
<script>
|
||||
function goFindPw(){
|
||||
$("#telNo").val($("#telNo").val().replace(/-/gi,""));
|
||||
$("#mobileNo").val($("#mobileNo").val().replace(/-/gi,""));
|
||||
var regExp = /^\d{3}\d{3,4}\d{4}$/;
|
||||
|
||||
if(!regExp.test($("#telNo").val()) || $("#telNo").val()==""){
|
||||
if(!regExp.test($("#mobileNo").val()) || $("#mobileNo").val()==""){
|
||||
|
||||
alert("형식에 맞지 않는 번호입니다.");
|
||||
return false;
|
||||
@ -64,7 +64,7 @@ function goFindPw(){
|
||||
<h1>비밀번호 찾기</h1>
|
||||
<p>회원님의 본인확인을 위해 가입시 등록하신 이메일/휴대폰번호를 입력하여 주시기 바랍니다.</p><br>
|
||||
Email <input type="text" id="loginUserId" name="loginUserId">
|
||||
핸드폰 번호 <input type="text" id="telNo" name="telNo">
|
||||
핸드폰 번호 <input type="text" id="mobileNo" name="mobileNo">
|
||||
<input type="button" onclick ="goFindPw();" value="임시비밀번호 받기">
|
||||
</form>
|
||||
</body>
|
||||
|
||||
@ -38,8 +38,8 @@
|
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
|
||||
<script type="text/javaScript" language="javascript" defer="defer">
|
||||
function signUp(){
|
||||
var p = document.getElementById('userPwd');
|
||||
var p_cf = document.getElementById('userPwdConfirm');
|
||||
var p = document.getElementById('password');
|
||||
var p_cf = document.getElementById('passwordConfirm');
|
||||
|
||||
if(p.value != p_cf.value)
|
||||
{
|
||||
@ -48,13 +48,13 @@ function signUp(){
|
||||
return false;
|
||||
}
|
||||
|
||||
if($("#phoneCertYn").val()!="Y")
|
||||
if($("#mobileCertYn").val()!="Y")
|
||||
{
|
||||
alert("휴대전화 인증이 필요합니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if($("#zipcode").val()=="" || $("#addr1").val()=="" || $("#addr2").val()=="")
|
||||
if($("#zipCode").val()=="" || $("#address").val()=="" || $("#addressDetail").val()=="")
|
||||
{
|
||||
alert("주소를 입력해주세요.");
|
||||
return false;
|
||||
@ -65,7 +65,12 @@ function signUp(){
|
||||
}
|
||||
|
||||
if(confirm("회원가입하시겠습니까?")){
|
||||
$("#birthdate").val($("#birth_yy").val()+$("#birth_mm").val()+$("#birth_dd").val());
|
||||
$("#birthday").val($("#birth_yy").val()+$("#birth_mm").val()+$("#birth_dd").val());
|
||||
|
||||
<%
|
||||
//연락받을 이메일 입력
|
||||
%>
|
||||
$("#email").val(("#loginUserId").val())
|
||||
alert("회원가입 되었습니다.");
|
||||
return true;
|
||||
}else{
|
||||
@ -84,8 +89,8 @@ $(document).ready(function() {
|
||||
<%
|
||||
//핸드폰 번호가 변하는것 실시간 감지
|
||||
%>
|
||||
$("#telNo").on("propertychange change keyup paste input", function() {
|
||||
$("#phoneCertYn").val("N");
|
||||
$("#mobileNo").on("propertychange change keyup paste input", function() {
|
||||
$("#mobileCertYn").val("N");
|
||||
});
|
||||
<%
|
||||
//아이디가 변하는것 실시간 감지
|
||||
@ -101,20 +106,20 @@ $(document).ready(function() {
|
||||
function emailCert(){
|
||||
|
||||
|
||||
$("#telNo").val($("#telNo").val().replace(/-/gi,""));
|
||||
$("#mobileNo").val($("#mobileNo").val().replace(/-/gi,""));
|
||||
var regExp = /^\d{3}\d{3,4}\d{4}$/;
|
||||
|
||||
if(!regExp.test($("#telNo").val()) || $("#telNo").val()==""){
|
||||
if(!regExp.test($("#mobileNo").val()) || $("#mobileNo").val()==""){
|
||||
|
||||
alert("형식에 맞지 않는 번호입니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url : "/nlib/member/phoneCertNum.ajax",
|
||||
url : "/nlib/member/mobileCertNum.ajax",
|
||||
type : "POST",
|
||||
async: false,
|
||||
data : {"telNo" : $("#telNo").val()},
|
||||
data : {"mobileNo" : $("#mobileNo").val()},
|
||||
success : function(result){
|
||||
alert("이메일 인증번호가 발송됐습니다.");
|
||||
//인증번호 확인창
|
||||
@ -128,27 +133,27 @@ function emailCert(){
|
||||
<%
|
||||
//핸드폰 인증번호 받기
|
||||
%>
|
||||
function phoneCert(){
|
||||
function mobileCert(){
|
||||
|
||||
|
||||
$("#telNo").val($("#telNo").val().replace(/-/gi,""));
|
||||
$("#mobileNo").val($("#mobileNo").val().replace(/-/gi,""));
|
||||
var regExp = /^\d{3}\d{3,4}\d{4}$/;
|
||||
|
||||
if(!regExp.test($("#telNo").val()) || $("#telNo").val()==""){
|
||||
if(!regExp.test($("#mobileNo").val()) || $("#mobileNo").val()==""){
|
||||
|
||||
alert("형식에 맞지 않는 번호입니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url : "/nlib/member/phoneCertNum.ajax",
|
||||
url : "/nlib/member/mobileCertNum.ajax",
|
||||
type : "POST",
|
||||
async: false,
|
||||
data : {"telNo" : $("#telNo").val()},
|
||||
data : {"mobileNo" : $("#mobileNo").val()},
|
||||
success : function(result){
|
||||
alert("인증번호가 발송됐습니다.");
|
||||
//인증번호 확인창
|
||||
$("#phoneCertForm").css("display","block")
|
||||
$("#mobileCertForm").css("display","block")
|
||||
|
||||
},error : function(){
|
||||
}
|
||||
@ -163,16 +168,16 @@ function certNumCheck(){
|
||||
//ajax 사용자가 입력한 번호를 보내 RESTfull server에서 확인 success or fail 반환 (3분이내인지도)
|
||||
%>
|
||||
$.ajax({
|
||||
url : "/nlib/member/phoneCertNumChk.ajax",
|
||||
url : "/nlib/member/mobileCertNumChk.ajax",
|
||||
type : "POST",
|
||||
data : {"phoneCertNum" : $("#phoneCertNum").val(),
|
||||
"telNo" : $("#telNo").val()},
|
||||
data : {"mobileCertNum" : $("#mobileCertNum").val(),
|
||||
"mobileNo" : $("#mobileNo").val()},
|
||||
async: false,
|
||||
success : function(result){
|
||||
if(result=="true")
|
||||
{
|
||||
alert("인증되었습니다.");
|
||||
$("#phoneCertYn").val("Y");
|
||||
$("#mobileCertYn").val("Y");
|
||||
}else{
|
||||
alert("인증에 실패했습니다.");
|
||||
}
|
||||
@ -184,9 +189,9 @@ function certNumCheck(){
|
||||
|
||||
function jusoCallBack(zipNo,roadAddrPart,addrDetail){
|
||||
// 팝업페이지에서 주소입력한 정보를 받아서, 현 페이지에 정보를 등록합니다.
|
||||
$("#zipcode").val(zipNo);
|
||||
$("#addr1").val(roadAddrPart);
|
||||
$("#addr2").val(addrDetail);
|
||||
$("#zipCode").val(zipNo);
|
||||
$("#address").val(roadAddrPart);
|
||||
$("#addressDetail").val(addrDetail);
|
||||
}
|
||||
|
||||
document.addEventListener('keydown', function(event) {
|
||||
@ -367,7 +372,7 @@ label.error {
|
||||
<tr>
|
||||
<td id="title">이름</td>
|
||||
<td>
|
||||
<input type="text" id="userNm" name="userNm" maxlength="20" required >
|
||||
<input type="text" id="name" name="name" maxlength="20" required >
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -402,7 +407,7 @@ label.error {
|
||||
<tr>
|
||||
<td id="title">비밀번호</td>
|
||||
<td>
|
||||
<input type="password" id="userPwd" name="userPwd" minlength="8" maxlength="16"
|
||||
<input type="password" id="password" name="password" minlength="8" maxlength="16"
|
||||
oninvalid="this.setCustomValidity('8~16자 영문 대 소문자, 숫자, 특수문자를 사용하세요.')"
|
||||
oninput="this.setCustomValidity('')"
|
||||
pattern="^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{8,16}$" required>
|
||||
@ -412,30 +417,31 @@ label.error {
|
||||
<tr>
|
||||
<td id="title">비밀번호 확인</td>
|
||||
<td>
|
||||
<input type="password" id="userPwdConfirm" name="userPwdConfirm" minlength="8" maxlength="16" required>
|
||||
<input type="password" id="passwordConfirm" name="passwordConfirm" minlength="8" maxlength="16" required>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td id="title">주소</td>
|
||||
<td>
|
||||
<input type="text" id="zipcode" name="zipcode" ><button type="button" style="text-align:left;" class="btn-warning" onclick="goPopup()">주소검색</button><br>
|
||||
<input type="text" id="addr1" name="addr1" ><input type="text" id="addr2" name="addr2" >
|
||||
<input type="text" id="zipCode" name="zipCode" ><button type="button" style="text-align:left;" class="btn-warning" onclick="goPopup()">주소검색</button><br>
|
||||
<input type="text" id="address" name="address" ><input type="text" id="addressDetail" name="addressDetail" >
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="title">휴대전화</td>
|
||||
<td id="Cert">
|
||||
<input type="text" id="telNo" name="telNo" required ><button type="button" style="text-align:left;" class="btn-warning" onclick="phoneCert()" required>인증번호 받기</button>
|
||||
<div id="phoneCertForm" style="display:none;"><br><input type='text' id='phoneCertNum' name='phoneCertNum'> <button type='button' style='text-align:left;' class='btn-warning' onclick='certNumCheck()' >인증번호 확인</button></div>
|
||||
<input type="text" id="mobileNo" name="mobileNo" required ><button type="button" style="text-align:left;" class="btn-warning" onclick="mobileCert()" required>인증번호 받기</button>
|
||||
<div id="mobileCertForm" style="display:none;"><br><input type='text' id='mobileCertNum' name='mobileCertNum'> <button type='button' style='text-align:left;' class='btn-warning' onclick='certNumCheck()' >인증번호 확인</button></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<input type="hidden" id="birthdate" name="birthdate" >
|
||||
<input type="hidden" id="phoneCertYn" name="phoneCertYn" value="N">
|
||||
<input type="hidden" id="birthday" name="birthday" >
|
||||
<input type="hidden" id="mobileCertYn" name="mobileCertYn" value="N">
|
||||
<input type="hidden" id="emailCertYn" name="emailCertYn" value="Y">
|
||||
<input type="hidden" id="email" name="email" >
|
||||
<input type="submit" value="가입"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@ -41,22 +41,22 @@ $(document).ready(function() {
|
||||
<%
|
||||
//핸드폰 번호가 변하는것 실시간 감지
|
||||
%>
|
||||
$("#telNo").on("propertychange change keyup paste input", function() {
|
||||
$("#phoneCertYn").val("N");
|
||||
$("#mobileNo").on("propertychange change keyup paste input", function() {
|
||||
$("#mobileCertYn").val("N");
|
||||
});
|
||||
$("input:radio[name='gender']:radio[value='${loginVO.gender}']").prop("checked",true);
|
||||
|
||||
var birthdate='${loginVO.birthdate}';
|
||||
var birthday='${loginVO.birthday}';
|
||||
|
||||
$("#birth_yy").val(birthdate.substr(0,4));
|
||||
$("#birth_mm").val(birthdate.substr(4,2));
|
||||
$("#birth_dd").val(birthdate.substr(6,2));
|
||||
alert("22222 <c:out value="${loginVO.addr1}" escapeXml="false"/>");
|
||||
$("#birth_yy").val(birthday.substr(0,4));
|
||||
$("#birth_mm").val(birthday.substr(4,2));
|
||||
$("#birth_dd").val(birthday.substr(6,2));
|
||||
alert("22222 <c:out value="${loginVO.address}" escapeXml="false"/>");
|
||||
})
|
||||
|
||||
function update(){
|
||||
var p = document.getElementById('userPwd');
|
||||
var p_cf = document.getElementById('userPwdConfirm');
|
||||
var p = document.getElementById('password');
|
||||
var p_cf = document.getElementById('passwordConfirm');
|
||||
|
||||
if(p.value != p_cf.value)
|
||||
{
|
||||
@ -69,20 +69,20 @@ function update(){
|
||||
alert("생년월일이 형식에 맞지 않습니다. 확인해주세요.");
|
||||
return false;
|
||||
}
|
||||
if($("#phoneCertYn").val()!="Y")
|
||||
if($("#mobileCertYn").val()!="Y")
|
||||
{
|
||||
alert("휴대전화 인증이 필요합니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if($("#zipcode").val()=="" || $("#addr1").val()=="" || $("#addr2").val()=="")
|
||||
if($("#zipCode").val()=="" || $("#address").val()=="" || $("#addressDetail").val()=="")
|
||||
{
|
||||
alert("주소를 입력해주세요.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(confirm("정보를 수정하시겠습니까?")){
|
||||
$("#birthdate").val($("#birth_yy").val()+$("#birth_mm").val()+$("#birth_dd").val());
|
||||
$("#birthday").val($("#birth_yy").val()+$("#birth_mm").val()+$("#birth_dd").val());
|
||||
|
||||
var queryString = $("form[name=updateForm]").serialize() ;
|
||||
|
||||
@ -118,27 +118,27 @@ function goPopup(){
|
||||
<%
|
||||
//핸드폰 인증번호 받기
|
||||
%>
|
||||
function phoneCert(){
|
||||
function mobileCert(){
|
||||
|
||||
|
||||
$("#telNo").val($("#telNo").val().replace(/-/gi,""));
|
||||
$("#mobileNo").val($("#mobileNo").val().replace(/-/gi,""));
|
||||
var regExp = /^\d{3}\d{3,4}\d{4}$/;
|
||||
|
||||
if(!regExp.test($("#telNo").val()) || $("#telNo").val()==""){
|
||||
if(!regExp.test($("#mobileNo").val()) || $("#mobileNo").val()==""){
|
||||
|
||||
alert("형식에 맞지 않는 번호입니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url : "/nlib/member/phoneCertNum.ajax",
|
||||
url : "/nlib/member/mobileCertNum.ajax",
|
||||
type : "POST",
|
||||
async: false,
|
||||
data : {"telNo" : $("#telNo").val()},
|
||||
data : {"mobileNo" : $("#mobileNo").val()},
|
||||
success : function(result){
|
||||
alert("인증번호가 발송됐습니다.");
|
||||
//인증번호 확인창
|
||||
$("#phoneCertForm").css("display","block")
|
||||
$("#mobileCertForm").css("display","block")
|
||||
|
||||
},error : function(){
|
||||
}
|
||||
@ -153,16 +153,16 @@ function certNumCheck(){
|
||||
//ajax 사용자가 입력한 번호를 보내 RESTfull server에서 확인 success or fail 반환 (3분이내인지도)
|
||||
%>
|
||||
$.ajax({
|
||||
url : "/nlib/member/phoneCertNumChk.ajax",
|
||||
url : "/nlib/member/mobileCertNumChk.ajax",
|
||||
type : "POST",
|
||||
data : {"phoneCertNum" : $("#phoneCertNum").val(),
|
||||
"telNo" : $("#telNo").val()},
|
||||
data : {"mobileCertNum" : $("#mobileCertNum").val(),
|
||||
"mobileNo" : $("#mobileNo").val()},
|
||||
async: false,
|
||||
success : function(result){
|
||||
if(result=="true")
|
||||
{
|
||||
alert("인증되었습니다.");
|
||||
$("#phoneCertYn").val("Y");
|
||||
$("#mobileCertYn").val("Y");
|
||||
}else{
|
||||
alert("인증에 실패했습니다.");
|
||||
}
|
||||
@ -173,9 +173,9 @@ function certNumCheck(){
|
||||
|
||||
function jusoCallBack(zipNo,roadAddrPart,addrDetail){
|
||||
// 팝업페이지에서 주소입력한 정보를 받아서, 현 페이지에 정보를 등록합니다.
|
||||
$("#zipcode").val(zipNo);
|
||||
$("#addr1").val(roadAddrPart);
|
||||
$("#addr2").val(addrDetail);
|
||||
$("#zipCode").val(zipNo);
|
||||
$("#address").val(roadAddrPart);
|
||||
$("#addressDetail").val(addrDetail);
|
||||
}
|
||||
|
||||
|
||||
@ -355,7 +355,7 @@ label.error {
|
||||
<tr>
|
||||
<td id="title">이름</td>
|
||||
<td>
|
||||
<input type="text" id="userNm" name="userNm" maxlength="20" required value=<c:out value="${loginVO.userNm}"/>>
|
||||
<input type="text" id="name" name="name" maxlength="20" required value=<c:out value="${loginVO.name}"/>>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -390,7 +390,7 @@ label.error {
|
||||
<tr>
|
||||
<td id="title">비밀번호</td>
|
||||
<td>
|
||||
<input type="password" id="userPwd" name="userPwd" minlength="8" maxlength="16"
|
||||
<input type="password" id="password" name="password" minlength="8" maxlength="16"
|
||||
oninvalid="this.setCustomValidity('8~16자 영문 대 소문자, 숫자, 특수문자를 사용하세요.')"
|
||||
oninput="this.setCustomValidity('')"
|
||||
pattern="^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{8,16}$" required>
|
||||
@ -400,30 +400,30 @@ label.error {
|
||||
<tr>
|
||||
<td id="title">비밀번호 확인</td>
|
||||
<td>
|
||||
<input type="password" id="userPwdConfirm" name="userPwdConfirm" minlength="8" maxlength="16" required>
|
||||
<input type="password" id="passwordConfirm" name="passwordConfirm" minlength="8" maxlength="16" required>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td id="title">주소</td>
|
||||
<td>
|
||||
<input type="text" id="zipcode" name="zipcode" value="<c:out value="${loginVO.zipcode}"/>" readonly ><button type="button" style="text-align:left;" class="btn-warning" onclick="goPopup()">주소검색</button><br>
|
||||
<input type="text" id="addr1" name="addr1" value="<c:out value="${loginVO.addr1}" escapeXml="false"/>" readonly />
|
||||
<input type="text" id="addr2" name="addr2" value="<c:out value="${loginVO.addr2}"/>" readonly />
|
||||
<input type="text" id="zipCode" name="zipCode" value="<c:out value="${loginVO.zipCode}"/>" readonly ><button type="button" style="text-align:left;" class="btn-warning" onclick="goPopup()">주소검색</button><br>
|
||||
<input type="text" id="address" name="address" value="<c:out value="${loginVO.address}" escapeXml="false"/>" readonly />
|
||||
<input type="text" id="addressDetail" name="addressDetail" value="<c:out value="${loginVO.addressDetail}"/>" readonly />
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="title">휴대전화</td>
|
||||
<td id="Cert">
|
||||
<input type="text" id="telNo" name="telNo" required value="<c:out value="${loginVO.telNo}"/>" ><button type="button" style="text-align:left;" class="btn-warning" onclick="phoneCert()" required>인증번호 받기</button>
|
||||
<div id="phoneCertForm" style="display:none;"><br><input type='text' id='phoneCertNum' name='phoneCertNum'> <button type='button' style='text-align:left;' class='btn-warning' onclick='certNumCheck()' >인증번호 확인</button></div>
|
||||
<input type="text" id="mobileNo" name="mobileNo" required value="<c:out value="${loginVO.mobileNo}"/>" ><button type="button" style="text-align:left;" class="btn-warning" onclick="mobileCert()" required>인증번호 받기</button>
|
||||
<div id="mobileCertForm" style="display:none;"><br><input type='text' id='mobileCertNum' name='mobileCertNum'> <button type='button' style='text-align:left;' class='btn-warning' onclick='certNumCheck()' >인증번호 확인</button></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<input type="hidden" id="phoneCertYn" name="phoneCertYn" value=<c:out value="Y"/>>
|
||||
<input type="hidden" id="birthdate" name="birthdate" >
|
||||
<input type="hidden" id="mobileCertYn" name="mobileCertYn" value=<c:out value="Y"/>>
|
||||
<input type="hidden" id="birthday" name="birthday" >
|
||||
<input type="submit" value="수정"/> <input type="button" onclick="javascript:location.href='${pageContext.request.contextPath}/userInfo/getMyInfo.do';" value="취소">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user