This commit is contained in:
parent
9fd7460c19
commit
990e0adc45
|
|
@ -53,7 +53,7 @@ namespace NP.BO.Controllers
|
|||
public ActionResult adminreg(NP.Model.VMUser vm) { return ur(vm); }
|
||||
public ActionResult ur(VMUser vm)
|
||||
{
|
||||
vm.User = new Users() { status = 1, jointype=0, usertype = vm.viewname == "user" ? 1 : vm.viewname == "professor" ? 11 : 0 };
|
||||
vm.User = new Users() { status = 1, /*jointype=0,*/ usertype = vm.viewname == "user" ? 1 : vm.viewname == "professor" ? 11 : 0 };
|
||||
vm.Lects = new List<Lect>() { };
|
||||
vm.FileList = new List<File>() { };
|
||||
vm.CMPRs = new List<CMPR>() { };
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
<div class="line line-dashed line-lg pull-in"></div><div class="form-group">
|
||||
<label class="col-sm-4 col-md-2 control-label req">이름</label>
|
||||
<div class="col-sm-8 col-md-10">@Html.TextBoxFor(m => m.User.username, new { @class = "form-control disp-init", @style = "width: 300px;", @maxlength = "50" })</div>
|
||||
@Html.HiddenFor(m=>m.User.jointype)
|
||||
</div>
|
||||
@if (Model.viewname == "user")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -446,7 +446,19 @@ namespace NP.Base.Controllers
|
|||
}
|
||||
return JsonOK(0);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult SnsLink(String snsid, int jointype = 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
Dao.Save("users.snslink.up", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo }, { "snsid", snsid }, { "jointype", jointype }, { "uno", SUserInfo.UserNo }, { "uip", GetUserIP() } });
|
||||
return JsonBack(new JsonRtn() { code = 1 });
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return JsonBack(new JsonRtn() { code = -1 });
|
||||
}
|
||||
}
|
||||
[HttpPost]
|
||||
public JsonResult SendLakey(Int64 lectno, String mobile)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@
|
|||
<select id="users.users" parameterClass="hashtable" resultClass="users">
|
||||
select a.*
|
||||
from (
|
||||
select a.userno,a.usertype,a.asno,a.pasname,a.userid,a.username,a.status,a.gender
|
||||
select a.userno,a.usertype,a.asno,a.pasname,a.userid,a.username,a.status,a.gender,a.jointype
|
||||
,b.asname,b.isjoin,b.ceoname,b.brno,b.post aspost,b.address1 asaddress1,b.address2 asaddress2,b.btype asbtype,b.bkind asbkind
|
||||
,CAST(AES_DECRYPT(UNHEX(a.email), <include refid="sql.digest"></include>) AS char) email
|
||||
,CAST(AES_DECRYPT(UNHEX(a.mobile), <include refid="sql.digest"></include>) AS char) mobile
|
||||
|
|
@ -334,16 +334,16 @@
|
|||
,userpno =case when #userpno# is not null then HEX(AES_ENCRYPT(#userpno#, <include refid="sql.digest"></include>)) else null end
|
||||
,bankname =case when #bankname# is not null then #bankname# else bankname end
|
||||
,bankno =case when #bankno# is not null then HEX(AES_ENCRYPT(#bankno#, <include refid="sql.digest"></include>)) else bankno end
|
||||
,post =case when #post# is not null then #post# else post end
|
||||
,address1 =case when #address1# is not null then #address1# else address1 end
|
||||
,address2 =case when #address2# is not null then #address2# else address2 end
|
||||
,introhtml =case when #introhtml# is not null then #introhtml# else introhtml end
|
||||
,isacceptmobile = #isacceptmobile#
|
||||
,uduty = #uduty#
|
||||
,slevel = #slevel#
|
||||
,jointype = #jointype#
|
||||
,isassignuser = #isassignuser#
|
||||
,birthday = case when #birthday# is not null then HEX(AES_ENCRYPT(#birthday#, <include refid="sql.digest"></include>)) else birthday end
|
||||
,post =case when #post# is not null then #post# else post end
|
||||
,address1 =case when #address1# is not null then #address1# else address1 end
|
||||
,address2 =case when #address2# is not null then #address2# else address2 end
|
||||
,introhtml =case when #introhtml# is not null then #introhtml# else introhtml end
|
||||
,isacceptmobile = #isacceptmobile#
|
||||
,uduty = #uduty#
|
||||
,slevel = #slevel#
|
||||
,jointype =case when #jointype# is not null then #jointype# else jointype end
|
||||
,isassignuser = #isassignuser#
|
||||
,birthday = case when #birthday# is not null then HEX(AES_ENCRYPT(#birthday#, <include refid="sql.digest"></include>)) else birthday end
|
||||
,kfcfyear =case when #kfcfyear# is not null then #kfcfyear# else kfcfyear end
|
||||
<isEqual property="savefrontbuy" compareValue="1">
|
||||
,isassignuser =#isassignuser#,kfcfyear =#kfcfyear#,edus=#edus#
|
||||
|
|
@ -680,6 +680,12 @@
|
|||
from users a
|
||||
where a.snsid=#snsid# and a.jointype=#jointype#
|
||||
</select>
|
||||
|
||||
<update id="users.snslink.up" parameterClass="hashtable">
|
||||
update users set <include refid="sql.up"></include>
|
||||
,snsid=#snsid# ,jointype=#jointype#
|
||||
where userno=#userno#
|
||||
</update>
|
||||
</statements>
|
||||
</sqlMap>
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,6 @@ namespace NP.FO.Controllers
|
|||
{
|
||||
public class AccountController : FOOpenBaseController
|
||||
{
|
||||
//전역변수 SNS 로그인 ClientID
|
||||
private string naverClientID = "fvaj0CdI04awGMEhaICy";
|
||||
private string kakaoClientID = "7b09519e7bce67d548a2a594a48acf63";
|
||||
private string googleClientID = "710934829793-eojibithnhn6t0ltq2dd1g1kunpiqbao.apps.googleusercontent.com";
|
||||
|
||||
public ActionResult FindMe(VMUser vm)
|
||||
{
|
||||
vm.User = new Users() { };
|
||||
|
|
@ -884,6 +879,16 @@ namespace NP.FO.Controllers
|
|||
return View();
|
||||
}
|
||||
|
||||
public ActionResult SNSLinkCallback(int jointype = 0)
|
||||
{
|
||||
//0:일반, 1:구글, 2:네이버, 3:카카오
|
||||
ViewBag.Jointype = jointype;
|
||||
ViewBag.naverClientID = naverClientID;
|
||||
ViewBag.kakaoClientID = kakaoClientID;
|
||||
ViewBag.googleClientID = googleClientID;
|
||||
return View();
|
||||
}
|
||||
|
||||
public String XPayVBankMoney()
|
||||
{
|
||||
var x = new Xpay();
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ namespace NP.FO.Controllers
|
|||
{
|
||||
public class FOBaseController : NP.Base.BaseController
|
||||
{
|
||||
//전역변수 SNS 로그인 ClientID
|
||||
public string naverClientID = "fvaj0CdI04awGMEhaICy";
|
||||
public string kakaoClientID = "7b09519e7bce67d548a2a594a48acf63";
|
||||
public string googleClientID = "710934829793-eojibithnhn6t0ltq2dd1g1kunpiqbao.apps.googleusercontent.com";
|
||||
|
||||
protected override void OnActionExecuting(ActionExecutingContext filterContext)
|
||||
{
|
||||
if (Request.AcceptTypes == null && !Request.Url.AbsolutePath.ToUpper().StartsWith("/OPEN/") && !Request.Url.AbsolutePath.ToUpper().StartsWith("/ACCOUNT/PAYVBANKMONEY"))
|
||||
|
|
|
|||
|
|
@ -386,6 +386,11 @@ namespace NP.FO.Controllers
|
|||
}
|
||||
public ActionResult MyInfoCheck(NP.Model.VMMy vm)
|
||||
{
|
||||
//sns인증
|
||||
ViewBag.naverClientID = naverClientID;
|
||||
ViewBag.kakaoClientID = kakaoClientID;
|
||||
ViewBag.googleClientID = googleClientID;
|
||||
|
||||
//인증키 확인
|
||||
if (vm.intval < 1 || Dao.Get<int>("users.usercheckconfirm", new System.Collections.Hashtable() { { "userno", SUserInfo.UserNo }, { "checkkey", vm.intval } }).First() < 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -672,6 +672,7 @@
|
|||
<Content Include="Views\Account\KakaoCallback.cshtml" />
|
||||
<Content Include="Views\Account\NaverCallbackJoin.cshtml" />
|
||||
<Content Include="Views\Account\GoogleCallback.cshtml" />
|
||||
<Content Include="Views\Account\SNSLinkCallback.cshtml" />
|
||||
<Content Include="Views\Shared\Partial\MobileChk.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,110 @@
|
|||
@{
|
||||
Layout = null;
|
||||
var naverClientId = ViewBag.naverClientID;
|
||||
var kakaoClientId = ViewBag.kakaoClientID;
|
||||
var googleClientId = ViewBag.googleClientID;
|
||||
|
||||
var jointype = ViewBag.Jointype;
|
||||
}
|
||||
<head>
|
||||
<!-- SNS -->
|
||||
@Html.Partial("./Partial/JS")
|
||||
<script type="text/javascript" src="/js/naveridlogin_js_sdk_2.0.0.js"></script>
|
||||
<script type="text/javascript" src="/js/kakao.js"></script>
|
||||
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||
<meta name="google-signin-client_id" content="@googleClientId">
|
||||
</head>
|
||||
<div class="g-signin2" data-onsuccess="onGoogleLogIn" style="display:none"></div> @*구글로그인관련*@
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
//네이버
|
||||
if (@jointype == 2) {
|
||||
window.resizeTo("500", "500");
|
||||
|
||||
var naverLogin = new naver.LoginWithNaverId(
|
||||
{
|
||||
clientId: "@naverClientId",
|
||||
callbackUrl: "https://www.ynicte.com/Account/SNSLinkCallback",
|
||||
isPopup: false,
|
||||
callbackHandle: true
|
||||
}
|
||||
);
|
||||
naverLogin.init();
|
||||
|
||||
naverLogin.getLoginStatus(function (status) {
|
||||
if (status) {
|
||||
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;
|
||||
}
|
||||
snsid = uniqId;
|
||||
//0:일반회원가입,1:google,2:naver,3:kakao
|
||||
capp("/focommon/SnsLink", { snsid: uniqId, jointype: 2 }, "snslink");
|
||||
} else {
|
||||
alert("네이버 AccessToken이 올바르지 않습니다. 관리자에게 문의하세요. error status[" + status + "]");
|
||||
}
|
||||
});
|
||||
}
|
||||
//카카오
|
||||
else if (@jointype == 3) {
|
||||
$.when(
|
||||
Kakao.init("@kakaoClientId")
|
||||
).done(function () {
|
||||
Kakao.API.request({
|
||||
url: '/v2/user/me',
|
||||
success: function (res) {
|
||||
snsid = res.id;
|
||||
//0:일반회원가입,1:google,2:naver,3:kakao
|
||||
capp("/focommon/SnsLink", { snsid: snsid, jointype: 3 }, "snslink");
|
||||
},
|
||||
fail: function (error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
var snsid;
|
||||
|
||||
//구글
|
||||
function onGoogleLogIn(googleUser) {
|
||||
var profile = googleUser.getBasicProfile();
|
||||
snsid = profile.getId();
|
||||
if (@jointype == 1) {
|
||||
capp("/focommon/SnsLink", { snsid: snsid, jointype: 1 }, "snslink");
|
||||
}
|
||||
}
|
||||
//공통
|
||||
function snslink() {
|
||||
if (capResult.code > 0) {
|
||||
msg("SNS 연동하였습니다.");
|
||||
goRefresh();
|
||||
}
|
||||
else {
|
||||
msg("SNS 연동에 실패하였습니다. \r\n관리자에게 문의하세요.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
function goRefresh() {
|
||||
if (@jointype == 2) {
|
||||
opener.location.href = "https://www.ynicte.com/My/MyinfoCheck";
|
||||
self.close();
|
||||
}
|
||||
else {
|
||||
location.href = "https://www.ynicte.com/My/MyinfoCheck";
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
@ -2,11 +2,21 @@
|
|||
@{
|
||||
var a = Model.Assign;
|
||||
var u = Model.User;
|
||||
|
||||
var naverClientId = ViewBag.naverClientID;
|
||||
var kakaoClientId = ViewBag.kakaoClientID;
|
||||
var googleClientId = ViewBag.googleClientID;
|
||||
}
|
||||
<head>
|
||||
<script type="text/javascript" src="/js/naveridlogin_js_sdk_2.0.0.js"></script>
|
||||
<script type="text/javascript" src="/js/kakao.js"></script>
|
||||
<script src="https://apis.google.com/js/platform.js?onload=googleInit" async defer></script>
|
||||
</head>
|
||||
<form id="mform" method="post" enctype="multipart/form-data">
|
||||
<div id="naverIdLogin" style="display:none"></div>
|
||||
<ul class="mpgTab col2">
|
||||
<li class="current"><a href="#">회원정보수정</a></li>
|
||||
<li><a href="#">SNS연동</a></li>
|
||||
<li class="current" id="liUserTab"><a href="#" onclick="selectTab('user')">회원정보수정</a></li>
|
||||
<li id="liSnsTab"><a href="#" onclick="selectTab('sns')">SNS연동</a></li>
|
||||
</ul>
|
||||
<input type="hidden" name="username" id="username" value="@u.username" />
|
||||
<input type="hidden" name="birthday" id="birthday" value="@u.birthday" />
|
||||
|
|
@ -116,6 +126,40 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="lgnWrap" style="display:none">
|
||||
<ul class="lgnSns">
|
||||
<li>
|
||||
@if (Model.User.jointype == 2)
|
||||
{
|
||||
<a href="javascript:cancelSnsLink()">네이버 아이디 연동해제</a>
|
||||
}
|
||||
else if (Model.User.jointype != 2)
|
||||
{
|
||||
<a href="javascript:confirmSns(2)">네이버 아이디로 연동하기</a>
|
||||
}
|
||||
</li>
|
||||
<li>
|
||||
@if (Model.User.jointype == 3)
|
||||
{
|
||||
<a href="javascript:cancelSnsLink()">카카오 아이디 연동해제</a>
|
||||
}
|
||||
else if (Model.User.jointype != 3)
|
||||
{
|
||||
<a href="javascript:confirmSns(3)">카카오 아이디로 연동하기</a>
|
||||
}
|
||||
</li>
|
||||
<li>
|
||||
@if (Model.User.jointype == 1)
|
||||
{
|
||||
<a href="javascript:cancelSnsLink()">구글 아이디 연동해제</a>
|
||||
}
|
||||
else if (Model.User.jointype != 1)
|
||||
{
|
||||
<a href="javascript:confirmSns(1)">구글 아이디로 연동하기</a>
|
||||
}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
@Html.Partial("./Partial/OkCert3", null, new ViewDataDictionary { })
|
||||
<ul class="lctBtn">
|
||||
|
|
@ -161,6 +205,8 @@
|
|||
$("#ccpositionetc").show().focus();
|
||||
}
|
||||
});
|
||||
|
||||
snsInit();
|
||||
});
|
||||
function setemail2() {
|
||||
setv("email2", val("email3"));
|
||||
|
|
@ -219,5 +265,88 @@
|
|||
msgadmin();
|
||||
}
|
||||
}
|
||||
|
||||
function selectTab(type) {
|
||||
if (type == "user") {
|
||||
$("#liSnsTab").removeClass("current");
|
||||
$("#liUserTab").addClass("current");
|
||||
$(".lgnWrap").hide();
|
||||
$(".clsTable").show();
|
||||
$(".lctBtn").show();
|
||||
|
||||
}
|
||||
else {
|
||||
$("#liUserTab").removeClass("current");
|
||||
$("#liSnsTab").addClass("current");
|
||||
$(".clsTable").hide();
|
||||
$(".lgnWrap").show();
|
||||
$(".lctBtn").hide();
|
||||
}
|
||||
}
|
||||
|
||||
function cancelSnsLink() {
|
||||
confirmtoggle(true, "SNS 연동해제 하시겠습니까?", "snsLink()");
|
||||
}
|
||||
function snsLink() {
|
||||
capp("/focommon/SnsLink", { snsid: null, jointype: 0 }, "afterSnsLink");
|
||||
}
|
||||
function afterSnsLink() {
|
||||
if (capResult.code > 0) {
|
||||
msg("SNS 연동을 해제하였습니다.");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
msg("SNS 연동해제에 실패하였습니다. \r\n관리자에게 문의하세요.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
function confirmSns(jointype) {
|
||||
if (jointype == 1) {
|
||||
confirmtoggle(true, "구글 아이디로 연동하시겠습니까?", "loginWithGoogle()");
|
||||
}
|
||||
else if (jointype == 2) {
|
||||
confirmtoggle(true, "네이버 아이디로 연동하시겠습니까?", "loginWithNaver()");
|
||||
}
|
||||
else if (jointype == 3) {
|
||||
confirmtoggle(true, "카카오 아이디로 연동하시겠습니까?", "loginWithKakao()");
|
||||
}
|
||||
}
|
||||
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');})});
|
||||
}
|
||||
|
||||
var naverLogin = new naver.LoginWithNaverId({ clientId: "@naverClientId", callbackUrl: "https://www.ynicte.com/Account/SNSLinkCallback?jointype=2",isPopup: true,loginButton: { color: "green", type: 3, height: 60 }});
|
||||
|
||||
function loginWithKakao() {
|
||||
Kakao.Auth.login({
|
||||
success: function (authObj) {
|
||||
location.href = "https://www.ynicte.com/Account/SNSLinkCallback?jointype=3"
|
||||
},
|
||||
fail: function (err) {
|
||||
alert("카카오 아이디로 로그인에 실패했습니다.");
|
||||
console.log(JSON.stringify(err))
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
function loginWithGoogle() {
|
||||
gauth = gapi.auth2.getAuthInstance();
|
||||
gauth.signIn().then(function () {
|
||||
location.href = "https://www.ynicte.com/Account/SNSLinkCallback?jointype=1"
|
||||
}, function () {
|
||||
alert("구글 아이디로 로그인에 실패했습니다.");
|
||||
return;
|
||||
});
|
||||
}
|
||||
|
||||
function loginWithNaver() {
|
||||
$("#naverIdLogin_loginButton > img").trigger("click");
|
||||
}
|
||||
|
||||
function snsInit() {
|
||||
naverLogin.init();
|
||||
Kakao.init("@kakaoClientId");
|
||||
}
|
||||
</script>
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue