72 lines
2.3 KiB
Plaintext
72 lines
2.3 KiB
Plaintext
@{
|
|
Layout = null;
|
|
var kakaoAppkey = "7b09519e7bce67d548a2a594a48acf63";
|
|
}
|
|
<head>
|
|
@Html.Partial("./Partial/JS")
|
|
<script type="text/javascript" src="/js/kakao.js"></script>
|
|
</head>
|
|
<script>
|
|
function kakaoDisplayToken() {
|
|
const token = getKakaoCookie('authorize-access-token')
|
|
if (token) {
|
|
Kakao.Auth.setAccessToken(token)
|
|
Kakao.Auth.getStatusInfo(({ status }) => {
|
|
if (status === 'connected') {
|
|
document.getElementById('token-result').innerText = 'login success. token: ' + Kakao.Auth.getAccessToken()
|
|
} else {
|
|
Kakao.Auth.setAccessToken(null)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
function getKakaoCookie(name) {
|
|
const value = "; " + document.cookie;
|
|
const parts = value.split("; " + name + "=");
|
|
if (parts.length === 2) return parts.pop().split(";").shift();
|
|
}
|
|
|
|
var snsid;
|
|
window.addEventListener('load', function () {
|
|
$.when(
|
|
Kakao.init("@kakaoAppkey"),
|
|
kakaoDisplayToken()
|
|
).done(function () {
|
|
Kakao.API.request({
|
|
url: '/v2/user/me',
|
|
success: function (res) {
|
|
snsid = res.id;
|
|
//0:일반회원가입,1:google,2:naver,3:kakao
|
|
capp("/focommon/CheckExistSnsId", { snsid: snsid, jointype: 3 }, "snslogin");
|
|
},
|
|
fail: function (error) {
|
|
console.log(error);
|
|
}
|
|
});
|
|
});
|
|
});
|
|
function snslogin() {
|
|
if (capResult.code > 0) {
|
|
capp("/focommon/SnsLogin", { uid: snsid, isSns: true }, "goHome()");
|
|
}
|
|
else {
|
|
if (confirm("SNS 회원정보가 존재하지 않습니다.\r\n회원가입 페이지로 이동하시겠습니까?")) {
|
|
goJoin();
|
|
}
|
|
else {
|
|
goIndex();
|
|
}
|
|
}
|
|
}
|
|
function goJoin() {
|
|
location.href = "https://www.ynicte.com/Account/JoinTSel";
|
|
}
|
|
function goHome() {
|
|
location.href = "https://www.ynicte.com";
|
|
}
|
|
function goIndex() {
|
|
location.href = "https://www.ynicte.com/Account/Index";
|
|
|
|
}
|
|
|
|
</script> |