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(); return View();
} }
public ActionResult NaverCallbackJoin()
{
return View();
}
public ActionResult KakaoCallback() public ActionResult KakaoCallback()
{ {
return View(); return View();

View File

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

View File

@ -107,14 +107,20 @@
{ {
clientId: "@naverClientId", clientId: "@naverClientId",
callbackUrl: "https://www.ynicte.com/Account/NaverCallback", callbackUrl: "https://www.ynicte.com/Account/NaverCallback",
isPopup: false, isPopup: true,
loginButton: { color: "green", type: 3, height: 60 }, loginButton: { color: "green", type: 3, height: 60 }
} }
); );
function loginWithKakao() { function loginWithKakao() {
Kakao.Auth.authorize({ Kakao.Auth.login({
redirectUri: 'https://www.ynicte.com/Account/KakaoCallback' 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") { if (@Request["jointype"] == "3") {
$.when( $.when(
Kakao.init("@kakaoAppkey"), Kakao.init("@kakaoAppkey"),
kakaoDisplayToken()
).done(function () { ).done(function () {
Kakao.API.request({ Kakao.API.request({
url: '/v2/user/me', 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> </script>
} }

View File

@ -32,15 +32,21 @@
var naverLogin = new naver.LoginWithNaverId( var naverLogin = new naver.LoginWithNaverId(
{ {
clientId: "@naverClientId", clientId: "@naverClientId",
callbackUrl: "https://www.ynicte.com/Account/Join?jointype=2", callbackUrl: "https://www.ynicte.com/Account/NaverCallbackJoin",
isPopup: false, isPopup: true,
loginButton: { color: "green", type: 3, height: 60 } loginButton: { color: "green", type: 3, height: 60 }
} }
); );
function loginWithKakao() { function loginWithKakao() {
Kakao.Auth.authorize({ Kakao.Auth.login({
redirectUri: 'https://www.ynicte.com/Account/Join?jointype=3' 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> <script type="text/javascript" src="/js/kakao.js"></script>
</head> </head>
<script> <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; var snsid;
window.addEventListener('load', function () { window.addEventListener('load', function () {
$.when( $.when(
Kakao.init("@kakaoAppkey"), Kakao.init("@kakaoAppkey")
kakaoDisplayToken()
).done(function () { ).done(function () {
Kakao.API.request({ Kakao.API.request({
url: '/v2/user/me', url: '/v2/user/me',

View File

@ -66,13 +66,16 @@
} }
} }
function goJoin() { 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() { function goHome() {
location.href = "https://www.ynicte.com"; opener.location.href = "https://www.ynicte.com";
self.close();
} }
function goIndex() { 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>