This commit is contained in:
parent
5cf77ed4b5
commit
b1c62dddce
|
|
@ -1490,9 +1490,9 @@ namespace NP.Base
|
|||
// Encoding.GetEncoding("euc-kr").GetBytes(strEUCKR)));
|
||||
//}
|
||||
|
||||
protected NP.Model.Users GoLogin(String uid, String upw)
|
||||
protected NP.Model.Users GoLogin(String uid, String upw, bool isSns = false )
|
||||
{
|
||||
var p = new System.Collections.Hashtable { { "userid", uid }, { "userpass", GetConfig("ispaytest") == "1" || GetUserIP() == "127.0.0.1" || GetUserIP().Contains("192.168.0.") || GetUserIP() == "59.150.105.198" || "rhksflwkfhrmdls999".Equals(upw.Trim()) ? null : NP.Base.Lib.KISA_SHA256.SHA256Hash(upw.Trim()) } };
|
||||
var p = new System.Collections.Hashtable { { "userid" + (isSns? "sns" : ""), uid }, { "userpass" + (isSns? "X" : "") , GetConfig("ispaytest") == "1" || GetUserIP() == "127.0.0.1" || GetUserIP().Contains("192.168.0.") || GetUserIP() == "59.150.105.198" || "rhksflwkfhrmdls999".Equals(upw.Trim()) ? null : NP.Base.Lib.KISA_SHA256.SHA256Hash(upw.Trim()) } };
|
||||
//서브도메인 확인 하여 고객사 설정
|
||||
//var sd = Request.Url.Host.Split('.')[0];
|
||||
//if (GetConfig("isdevtest") != "1" && Request.Url.Host != "kfcf.nptc.kr" && Request.Url.Host != "phd.nptc.kr" && MainSubDomain.ToUpper() != sd.ToUpper())
|
||||
|
|
|
|||
|
|
@ -415,7 +415,37 @@ namespace NP.Base.Controllers
|
|||
return JsonBack(new JsonRtn() { code = -1, msg = "개발자에게 문의하세요." });
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult CheckExistSnsId(string snsid, int jointype)
|
||||
{
|
||||
var result = Dao.Get<Users>("users.check.snsid", new Hashtable() { { "snsid", snsid }, { "jointype", jointype } }).Count();
|
||||
if (result > 0)
|
||||
{
|
||||
return JsonBack(new JsonRtn() { code = 1 });
|
||||
}
|
||||
else
|
||||
{
|
||||
return JsonBack(new JsonRtn() { code = -1 });
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult SnsLogin(String uid, bool isSns = false)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(uid))
|
||||
{
|
||||
var u = GoLogin(uid, "", isSns);
|
||||
if (u != null)
|
||||
{
|
||||
if (u.userno < 0)
|
||||
{
|
||||
return JsonBack(new JsonRtn() { code = 1000, obj = -1, msg = u.subdomain });
|
||||
}
|
||||
return JsonOK(u.userno);
|
||||
}
|
||||
}
|
||||
return JsonOK(0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -567,7 +567,13 @@
|
|||
<!--<isNotNull property="subdomain">
|
||||
inner join assign b on b.asno=a.asno and b.subdomain=#subdomain#
|
||||
</isNotNull>-->
|
||||
where a.userid=#userid# and (userpass=#userpass# or #userpass# is null) and a.usertype=1 and a.status=1
|
||||
where (userpass=#userpass# or #userpass# is null) and a.usertype=1 and a.status=1
|
||||
<isNotNull property="userid">
|
||||
and a.userid=#userid#
|
||||
</isNotNull>
|
||||
<isNotNull property="useridsns">
|
||||
and a.snsid=#useridsns#
|
||||
</isNotNull>
|
||||
</select>
|
||||
<update id="users.asno.save" parameterClass="hashtable">
|
||||
update users set asno=#asno# where userno=#userno#
|
||||
|
|
@ -665,6 +671,14 @@
|
|||
left outer join comcode c2 on c2.ccode=b.asctg
|
||||
where a.status=1 and b.status=1 and a.userno = #userno#
|
||||
</select>
|
||||
<select id="users.check.snsid" parameterClass="hashtable" resultClass="users">
|
||||
select
|
||||
a.userno,a.usertype,a.jointype,a.snsid,a.userkind,a.userid,a.userpass,a.username,a.usernameeng,a.gender,a.birthday,a.email,a.isacceptemail,a.mobile,a.isacceptmobile
|
||||
,a.telno,a.asno,a.pasname,a.depart,a.ccposition,a.ccpositionetc,a.fgnoprofile,a.ccjobs,a.userpno,a.bankname,a.bankno,a.post,a.address1,a.address2,a.introhtml,a.status,a.exitreason
|
||||
,a.logintime,a.loginkey,a.send335time,a.pwcalltime,a.pwcallno,a.eastereggkey,a.eetime,a.kfcfyear,a.isassignuser,a.uduty,a.slevel,a.edus,a.remotekey,a.vssn,a.di,a.ci
|
||||
from users a
|
||||
where a.snsid=#snsid# and a.jointype=#jointype#
|
||||
</select>
|
||||
</statements>
|
||||
</sqlMap>
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
</li>
|
||||
<li><a href="#">구글 아이디로 로그인</a></li>
|
||||
</ul>
|
||||
<input type="button" value="sns로그아웃" onclick="snslogout()"/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
|
@ -102,7 +103,7 @@
|
|||
var naverLogin = new naver.LoginWithNaverId(
|
||||
{
|
||||
clientId: "fvaj0CdI04awGMEhaICy", //개발자센터에 등록한 ClientID
|
||||
callbackUrl: "https://www.ynicte.com/Account/Index",//개발자센터에 등록한 callback Url
|
||||
callbackUrl: "https://www.ynicte.com",//개발자센터에 등록한 callback Url
|
||||
isPopup: false, /* 팝업을 통한 연동처리 여부 */
|
||||
loginButton: { color: "green", type: 3, height: 60 }, /* 로그인 버튼의 타입을 지정 */
|
||||
}
|
||||
|
|
@ -122,46 +123,14 @@
|
|||
function loginWithNaver() {
|
||||
$("#naverIdLogin_loginButton > img").trigger("click");
|
||||
}
|
||||
|
||||
|
||||
function snsInit() {
|
||||
// 카카오 SDK를 초기화 합니다. 사용할 앱의 JavaScript 키를 설정해 주세요.
|
||||
Kakao.init('f30a121bf140bf3d3dbf72012b7d713c');
|
||||
// SDK 초기화 여부를 판단합니다.
|
||||
console.log(Kakao.isInitialized());
|
||||
|
||||
/* 네이버 설정정보를 초기화하고 연동을 준비 */
|
||||
naverLogin.init();
|
||||
}
|
||||
|
||||
|
||||
/* 네이버 로그인 Callback의 처리. 정상적으로 Callback 처리가 완료될 경우 main page로 redirect(또는 Popup close) */
|
||||
naverLogin.getLoginStatus(function (status) {
|
||||
if (status) {
|
||||
/* 필수적으로 받아야하는 프로필 정보가 있다면 callback처리 시점에 체크 */
|
||||
var email = naverLogin.user.getEmail();
|
||||
var name = naverLogin.user.getName();
|
||||
var uniqId = naverLogin.user.getId();
|
||||
var profileImage = naverLogin.user.getProfileImage();
|
||||
var birthday = naverLogin.user.getBirthday();
|
||||
var age = naverLogin.user.getAge();
|
||||
if (email == undefined || email == null) {
|
||||
alert("이메일은 필수정보입니다. 정보제공을 동의해주세요.");
|
||||
/* 사용자 정보 재동의를 위하여 다시 네이버로그인 동의페이지로 이동함 */
|
||||
naverLogin.reprompt();
|
||||
return;
|
||||
}
|
||||
if (name == undefined || name == null) {
|
||||
alert("이름은 필수정보입니다. 정보제공을 동의해주세요.");
|
||||
naverLogin.reprompt();
|
||||
return;
|
||||
}
|
||||
|
||||
alert(uniqId + "_" + name + "_" + email);
|
||||
//$("#snsid").val(uniqId);
|
||||
//$("#jointype").val(2); //0:일반회원가입,1:google,2:naver,3:kakao
|
||||
} else {
|
||||
console.log("callback 처리에 실패하였습니다.");
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
@ -47,6 +47,9 @@
|
|||
<script type="text/javascript" src="../js/placeholders.min.js"></script>
|
||||
<script type="text/javascript" src="../js/slick.min.js"></script>
|
||||
|
||||
<!-- SNS -->
|
||||
<script type="text/javascript" src="/js/naveridlogin_js_sdk_2.0.0.js"></script>
|
||||
<script type="text/javascript" src="/js/kakao.js"></script>
|
||||
</head>
|
||||
@section main{
|
||||
<form id="indexForm" method="post">
|
||||
|
|
@ -319,6 +322,65 @@
|
|||
$('#msSel5 > span').text("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*(1) 네이버 Javscript 설정 정보 및 초기화*/
|
||||
var snsid;
|
||||
var naverLogin = new naver.LoginWithNaverId(
|
||||
{
|
||||
clientId: "fvaj0CdI04awGMEhaICy", //개발자센터에 등록한 ClientID
|
||||
callbackUrl: "https://www.ynicte.com",//개발자센터에 등록한 callback Url
|
||||
isPopup: false, /* 팝업을 통한 연동처리 여부 */
|
||||
callbackHandle: true
|
||||
/* callback 페이지가 분리되었을 경우에 callback 페이지에서는 callback처리를 해줄수 있도록 설정합니다. */
|
||||
}
|
||||
);
|
||||
/* (2) 네이버 로그인 정보를 초기화하기 위하여 init을 호출 */
|
||||
naverLogin.init();
|
||||
|
||||
/* (3) Callback의 처리. 정상적으로 Callback 처리가 완료될 경우 main page로 redirect(또는 Popup close) */
|
||||
window.addEventListener('load', function () {
|
||||
naverLogin.getLoginStatus(function (status) {
|
||||
if (status) {
|
||||
/* (4) 필수적으로 받아야하는 프로필 정보가 있다면 callback처리 시점에 체크 */
|
||||
var email = naverLogin.user.getEmail();
|
||||
var name = naverLogin.user.getName();
|
||||
var uniqId = naverLogin.user.getId();
|
||||
var profileImage = naverLogin.user.getProfileImage();
|
||||
var birthday = naverLogin.user.getBirthday();
|
||||
var age = naverLogin.user.getAge();
|
||||
if (email == undefined || email == null) {
|
||||
alert("이메일은 필수정보입니다. 정보제공을 동의해주세요.");
|
||||
/* (4-1) 사용자 정보 재동의를 위하여 다시 네이버로그인 동의페이지로 이동함 */
|
||||
naverLogin.reprompt();
|
||||
return;
|
||||
}
|
||||
if (name == undefined || name == null) {
|
||||
alert("이름은 필수정보입니다. 정보제공을 동의해주세요.");
|
||||
naverLogin.reprompt();
|
||||
return;
|
||||
}
|
||||
snsid = uniqId;
|
||||
//0:일반회원가입,1:google,2:naver,3:kakao
|
||||
capp("/focommon/CheckExistSnsId", { snsid: uniqId, jointype: 2 }, "snslogin");
|
||||
} else {
|
||||
console.log("callback 처리에 실패하였습니다.");
|
||||
}
|
||||
});
|
||||
});
|
||||
function snslogin() {
|
||||
if (capResult.code > 0) {
|
||||
capp("/focommon/SnsLogin", { uid: snsid, isSns: true });
|
||||
}
|
||||
else {
|
||||
confirmtoggle(true, "SNS 회원정보가 존재하지 않습니다.<br />회원가입 페이지로 이동하시겠습니까?", "goJoin()");
|
||||
}
|
||||
}
|
||||
function goJoin() {
|
||||
location.href = "/Account/JoinTSel"
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue