This commit is contained in:
hyunho 2020-11-26 01:39:18 +00:00
parent 170e000c52
commit 5a10a57d9b
8 changed files with 45 additions and 53 deletions

View File

@ -844,6 +844,10 @@ namespace NP.FO.Controllers
{
return View();
}
public ActionResult NaverCallbackJoin()
{
return View();
}
public ActionResult KakaoCallback()
{
return View();

View File

@ -670,6 +670,7 @@
<Content Include="Views\My\Document.cshtml" />
<Content Include="Views\Account\NaverCallback.cshtml" />
<Content Include="Views\Account\KakaoCallback.cshtml" />
<Content Include="Views\Account\NaverCallbackJoin.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />

View File

@ -107,14 +107,20 @@
{
clientId: "@naverClientId",
callbackUrl: "https://www.ynicte.com/Account/NaverCallback",
isPopup: false,
loginButton: { color: "green", type: 3, height: 60 },
isPopup: true,
loginButton: { color: "green", type: 3, height: 60 }
}
);
function loginWithKakao() {
Kakao.Auth.authorize({
redirectUri: 'https://www.ynicte.com/Account/KakaoCallback'
Kakao.Auth.login({
success: function (authObj) {
location.href = "https://www.ynicte.com/Account/KakaoCallback"
},
fail: function (err) {
alert("카카오 아이디로 로그인에 실패했습니다.");
console.log(JSON.stringify(err))
},
})
}

View File

@ -263,7 +263,6 @@ else
if (@Request["jointype"] == "3") {
$.when(
Kakao.init("@kakaoAppkey"),
kakaoDisplayToken()
).done(function () {
Kakao.API.request({
url: '/v2/user/me',
@ -285,24 +284,5 @@ else
}
});
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();
}
</script>
}

View File

@ -32,15 +32,21 @@
var naverLogin = new naver.LoginWithNaverId(
{
clientId: "@naverClientId",
callbackUrl: "https://www.ynicte.com/Account/Join?jointype=2",
isPopup: false,
loginButton: { color: "green", type: 3, height: 60 }
callbackUrl: "https://www.ynicte.com/Account/NaverCallbackJoin",
isPopup: true,
loginButton: { color: "green", type: 3, height: 60 }
}
);
function loginWithKakao() {
Kakao.Auth.authorize({
redirectUri: 'https://www.ynicte.com/Account/Join?jointype=3'
Kakao.Auth.login({
success: function (authObj) {
location.href = "https://www.ynicte.com/Account/Join?jointype=3"
},
fail: function (err) {
alert("카카오 아이디로 회원가입에 실패했습니다.");
console.log(JSON.stringify(err))
},
})
}

View File

@ -7,30 +7,10 @@
<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()
Kakao.init("@kakaoAppkey")
).done(function () {
Kakao.API.request({
url: '/v2/user/me',

View File

@ -66,13 +66,16 @@
}
}
function goJoin() {
location.href = "https://www.ynicte.com/Account/JoinTSel";
opener.location.href = "https://www.ynicte.com/Account/Join?jointype=2";
self.close();
}
function goHome() {
location.href = "https://www.ynicte.com";
opener.location.href = "https://www.ynicte.com";
self.close();
}
function goIndex() {
location.href = "https://www.ynicte.com/Account/Index";
opener.location.href = "https://www.ynicte.com/Account/Index";
self.close();
}

View File

@ -0,0 +1,12 @@
@{
Layout = null;
@Html.Partial("./Partial/JS")
}
<script>
$(document).ready(function () {
opener.location.href = "https://www.ynicte.com/Account/Join?jointype=2";
self.close();
});
</script>