YNICTE/FO/Views/Account/JoinTSel.cshtml

87 lines
2.8 KiB
Plaintext
Raw Normal View History

2020-11-25 16:04:00 +09:00
@{
2020-11-27 09:31:40 +09:00
var naverClientId = ViewBag.naverClientID;
var kakaoClientId = ViewBag.kakaoClientID;
var googleClientId = ViewBag.googleClientID;
2020-11-25 16:04:00 +09:00
}
<head>
2020-11-20 15:10:32 +09:00
<script type="text/javascript" src="/js/naveridlogin_js_sdk_2.0.0.js"></script>
<script type="text/javascript" src="/js/kakao.js"></script>
2020-11-27 09:31:40 +09:00
<script src="https://apis.google.com/js/platform.js?onload=googleInit" async defer></script>
2020-11-20 15:10:32 +09:00
</head>
<form id="mform" method="post">
<div class="jnSns">
<a href="#" onclick="javascript: $('#mform').attr('action', '/Account/JoinIdVeri').submit();">영남건설 기술 교육원 홈페이지 회원가입</a>
2020-11-20 15:10:32 +09:00
<div id="naverIdLogin" style="display:none"></div>
<ul class="lgnSns">
2020-11-20 15:10:32 +09:00
<li>
<a href="javascript:loginWithNaver()">네이버 아이디로 회원가입</a>
</li>
<li>
<a href="javascript:loginWithKakao()">카카오 아이디로 회원가입</a>
</li>
2020-11-27 09:31:40 +09:00
<li>
<a href="javascript:loginWithGoogle()">구글 아이디로 회원가입</a>
</li>
</ul>
2020-11-25 16:04:00 +09:00
</div>
</form>
2020-11-20 15:10:32 +09:00
<script>
$(document).ready(function () {
snsInit();
});
2020-11-27 09:31:40 +09:00
var gauth;
function googleInit() {
gapi.load('auth2', function () {
var gauth = gapi.auth2.init({
client_id: "@googleClientId",
scope: 'profile'
});
gauth.then(function () {
console.log('google init success');
}, function () {
console.error('google init fail');
})
});
}
2020-11-20 15:10:32 +09:00
var naverLogin = new naver.LoginWithNaverId(
{
2020-11-25 16:04:00 +09:00
clientId: "@naverClientId",
2020-11-26 10:39:18 +09:00
callbackUrl: "https://www.ynicte.com/Account/NaverCallbackJoin",
isPopup: true,
loginButton: { color: "green", type: 3, height: 60 }
2020-11-20 15:10:32 +09:00
}
);
function loginWithKakao() {
2020-11-27 09:31:40 +09:00
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));
},
2020-11-20 15:10:32 +09:00
})
}
function loginWithNaver() {
2020-11-25 16:04:00 +09:00
$("#naverIdLogin_loginButton > img").trigger("click");
2020-11-20 15:10:32 +09:00
}
2020-11-27 09:31:40 +09:00
function loginWithGoogle() {
gauth = gapi.auth2.getAuthInstance();
gauth.signIn().then(function () {
location.href = "https://www.ynicte.com/Account/Join?jointype=1";
});
}
2020-11-20 15:10:32 +09:00
function snsInit() {
naverLogin.init();
2020-11-27 09:31:40 +09:00
Kakao.init("@kakaoClientId");
2020-11-20 15:10:32 +09:00
}
</script>