提交 ec9dee6f 编写于 作者: laizhilong's avatar laizhilong

钉钉授权登录

上级 daa30cfc
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="../favicon.ico">
<title>ibzuaa</title>
<script src="https://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"></script>
<script>
$(function () {
var code = getUrlParam('code');
var state = getUrlParam('state');
// alert("code:" + code + "\n state:" + state);
if (code && state) {
// 通过授权code请求后台
// alert(window.location.hostname);
var opt = {"code": code, "state": state};
$.ajax({
type: "post",
url: "../uaa/queryDingtalkUserByCode",
dataType: "json",
data: JSON.stringify(opt),
contentType: 'application/json',
success: function (data) {
// console.log(JSON.stringify(data));
if (data) {
if (data.token) {
localStorage.setItem('token', data.token);
}
if (data.user) {
localStorage.setItem('user', JSON.stringify(data.user));
}
if (data.ibzuser) {
var ibzuser = JSON.stringify(data.ibzuser);
// 设置cookie,保存账号密码7天
setCookie(ibzuser.loginname, ibzuser.password, 7);
// 跳转首页
window.location.href = "../index";
} else {
// 跳转微信绑定
alert("跳转到微信")
window.location.href = "../#/weixinLoginRedirect?code=" + code + "&state=" + state;
}
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.readyState + XMLHttpRequest.status + XMLHttpRequest.responseText);
// 回到登录页
window.location.href = "../";
}
});
} else {
alert("微信授权登录失败!");
// 回到登录页
window.location.href = "../";
}
});
// 获取url中的参数
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]);
return null; //返回参数值
}
// 设置cookie
function setCookie(loginname, password, exdays) {
// 获取时间
let exdate = new Date();
// 保存的天数
exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays);
// 字符串拼接cookie
window.document.cookie = "loginname" + "=" + loginname + ";path=/;expires=" + exdate.toUTCString();
window.document.cookie = "password" + "=" + password + ";path=/;expires=" + exdate.toUTCString();
}
</script>
</head>
<body>
</body>
</html>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M511.999 1024a512 512 0 1 0-512-512 512 512 0 0 0 512 512z" fill="#23A0F0" /><path d="M735.765 604.422c-3.55-49.47-36.192-90.932-55.09-112.47a70.383 70.383 0 0 0-15.577-67.003v-1.718c0-97.235-68.028-167.254-153.35-167.55-85.333 0.342-153.35 70.315-153.35 167.55v1.718a70.383 70.383 0 0 0-15.576 67.003c-18.898 21.413-51.54 62.874-55.09 112.47a75.39 75.39 0 0 0 7.554 40.425c7.555 10.308 28.513-2.06 43.406-34.93a210.33 210.33 0 0 0 35.499 67.914c-36.307 8.477-46.729 44.897-34.475 64.853 8.59 14.086 28.445 25.657 62.419 25.657 60.473 0 87.267-16.611 99.18-28.057a16.259 16.259 0 0 1 20.844 0c11.913 11.57 38.684 28.057 99.18 28.057 34.02 0 53.715-11.57 62.419-25.657 12.253-19.922 1.831-56.342-34.475-64.853a211.627 211.627 0 0 0 35.499-67.914c14.893 32.87 35.85 45.124 43.406 34.93a76.493 76.493 0 0 0 7.577-40.425z" fill="#FFFFFF" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1592560654178" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="17475" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M506.054591 880.192733c0 43.505863-63.615876 78.773088-142.089136 78.773088s-142.089136-35.268248-142.089135-78.773088 63.615876-78.773088 142.089135-78.773088 142.089136 35.268248 142.089136 78.773088z m153.385413-78.773088c-78.474282 0-142.089136 35.268248-142.089136 78.773088s63.615876 78.773088 142.089136 78.773088 142.089136-35.268248 142.089135-78.773088-63.615876-78.773088-142.089135-78.773088z" fill="#FFC817" p-id="17476"></path><path d="M825.904293 502.377852s-10.752902-11.024078-22.294772-21.221324V355.234607c0-161.052023-130.558521-291.610544-291.610544-291.610544S220.389456 194.182584 220.389456 355.234607v125.921921c-11.540847 10.197246-22.294772 21.221324-22.294772 21.221324-19.024286 28.53694-64.207347 102.256942-64.207348 171.815157s19.024286 81.449034 26.158777 82.043575c6.616698 0.551562 31.131021-6.063089 60.262502-50.654681 39.425941 131.09985 154.970514 226.037083 291.393603 226.037083 136.639007 0 252.337075-95.236038 291.583938-226.658229 29.309536 45.151339 54.020334 51.829436 60.667731 51.275827 7.134491-0.594541 26.158776-12.485359 26.158777-82.043575S844.928578 530.914792 825.904293 502.377852z" fill="#37474F" p-id="17477"></path><path d="M297.454646 552.317241a375.358947 375.358947 0 0 0-3.473101 51.128471c0 159.245887 99.199303 288.340057 221.567281 288.340057s221.567281-129.09417 221.567281-288.340057a375.522676 375.522676 0 0 0-3.473101-51.128471H297.454646zM435.307294 197.390649c-32.506345 0-58.857503 35.733852-58.857503 79.81379 0 44.079938 26.351158 79.81379 58.857503 79.813791s58.857503-35.733852 58.857502-79.813791c0-44.079938-26.352181-79.81379-58.857502-79.81379z m9.809413 112.660896c-11.82021 0-21.402449-14.639418-21.402449-32.698726s9.582239-32.698726 21.402449-32.698726c11.82021 0 21.402449 14.639418 21.402449 32.698726s-9.582239 32.698726-21.402449 32.698726zM590.476329 197.390649c-32.506345 0-58.857503 35.733852-58.857503 79.81379 0 44.079938 26.351158 79.81379 58.857503 79.813791s58.857503-35.733852 58.857503-79.813791c-0.001023-44.079938-26.352181-79.81379-58.857503-79.81379z m9.93221 82.787518l-0.030699 0.005117c0.001023 0.021489 0.023536 0.033769 0.023536 0.055258 0 0.896416-0.726547 1.622964-1.622964 1.622964-0.738827 0-1.25969-0.544399-1.455141-1.218758l-0.062422 0.00921v0.149403c-3.748371-9.331529-10.383488-15.635095-18.079774-15.635096-7.693216 0-14.325263 6.296403-18.074657 15.620769l-0.059352-0.036839-0.055258-0.012279c-0.264013 0.557702-0.722454 1.00284-1.380441 1.00284a1.647523 1.647523 0 0 1-1.648546-1.648547c0-0.016373 0.017396-0.025583 0.017396-0.040932l-0.035815-0.008186c-0.058328-0.895393-0.166799-1.768273-0.166799-2.688226 0-18.059308 9.582239-32.698726 21.402449-32.698726s21.402449 14.639418 21.402449 32.698726c0 0.966001-0.110517 1.883907-0.173962 2.823302z" fill="#FFFFFF" p-id="17478"></path><path d="M281.18817 536.26566c-5.350868 26.753317-16.646122 146.845463-11.296277 173.59878s27.855418 22.285562 60.046585 22.591531c31.211862 0.296759 67.774593 8.918114 68.369133-30.320563 0.594541-39.237653 0.594541-116.5249 9.512655-145.06184 8.91709-28.53694-126.632095-20.807908-126.632096-20.807908z" fill="#FF3B30" p-id="17479"></path><path d="M274.071076 593.588203l125.538181 40.585347c1.089821-30.820959 3.295046-61.368696 8.211009-77.101005 8.918114-28.53694-126.632095-20.807908-126.632096-20.807908-1.948375 9.739828-4.683672 31.851429-7.117094 57.323566z" fill="#DD2C00" p-id="17480"></path><path d="M512.594541 467.895503c97.846492 0 177.166025-35.671431 177.166025-57.668421 0-16.646122-79.319533-33.887808-177.166025-33.887808-97.845469 0-177.166025 15.458063-177.166026 33.887808 0 20.808932 79.319533 57.668421 177.166026 57.668421z" fill="#FFC817" p-id="17481"></path><path d="M514.378164 489.298975s112.363114 1.189082 202.13572-36.860512c89.771583-38.048571 88.880283-42.358737 98.689696-42.358737 9.809413 0 21.402449 14.123672 26.307156 39.61116 4.904707 25.487487 10.701736 45.552475-10.255575 58.037834-20.956288 12.484336-158.290119 93.190449-313.012993 93.190449h-7.729032c-154.722874 0-292.056706-80.706113-313.012993-93.190449s-15.160281-32.549324-10.255575-58.037834c4.904707-25.487487 16.497743-39.61116 26.307156-39.61116s8.918114 4.310166 98.689696 42.358737 202.136743 36.860513 202.136744 36.860512z" fill="#FF3B30" p-id="17482"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1592559616839" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8348" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M863.168 398.912c-1.568 6.56-5.376 16.16-10.752 27.744h0.128l-0.64 1.088c-31.296 67.072-113.024 198.624-113.024 198.624s-0.096-0.32-0.416-0.8l-23.872 41.6h115.104L609.856 960l49.888-199.2h-90.56l31.456-131.712a1282.24 1282.24 0 0 0-91.2 26.08s-48.224 28.288-138.88-54.4c0 0-61.184-53.952-25.728-67.424 15.104-5.76 73.216-13.024 118.976-19.2 61.792-8.384 99.84-12.8 99.84-12.8s-190.592 2.848-235.808-4.288c-45.216-7.104-102.56-82.656-114.784-149.12 0 0-18.88-36.448 40.64-19.2 59.52 17.28 305.92 67.232 305.92 67.232S239.2 297.568 217.888 273.568c-21.344-24-62.752-131.04-57.376-196.8 0 0 2.336-16.416 19.136-12.032 0 0 236.896 108.448 398.912 167.808 161.984 59.36 302.816 89.536 284.64 166.4z" fill="#3296FA" p-id="8349"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg class="icon" width="200px" height="200.00px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path fill="#36ab60" d="M352.814545 385.396364m-33.512727 0a33.512727 33.512727 0 1 0 67.025455 0 33.512727 33.512727 0 1 0-67.025455 0Z" /><path fill="#36ab60" d="M502.690909 384.465455m-33.512727 0a33.512727 33.512727 0 1 0 67.025454 0 33.512727 33.512727 0 1 0-67.025454 0Z" /><path fill="#36ab60" d="M576.232727 534.341818m-23.272727 0a23.272727 23.272727 0 1 0 46.545455 0 23.272727 23.272727 0 1 0-46.545455 0Z" /><path fill="#36ab60" d="M694.458182 536.203636m-23.272727 0a23.272727 23.272727 0 1 0 46.545454 0 23.272727 23.272727 0 1 0-46.545454 0Z" /><path fill="#36ab60" d="M512 0C229.003636 0 0 229.003636 0 512s229.003636 512 512 512 512-229.003636 512-512S794.996364 0 512 0z m-87.505455 630.225455c-26.996364 0-48.407273-5.585455-75.403636-11.17091l-75.403636 37.236364 21.410909-64.232727c-53.992727-37.236364-85.643636-85.643636-85.643637-145.221818 0-102.4 96.814545-182.458182 215.04-182.458182 105.192727 0 198.283636 64.232727 216.901819 150.807273-6.516364-0.930909-13.963636-0.930909-20.48-0.93091-102.4 0-182.458182 76.334545-182.458182 170.356364 0 15.825455 2.792727 30.72 6.516363 44.683636-7.447273 0-13.963636 0.930909-20.48 0.93091z m314.647273 75.403636l15.825455 53.992727-58.647273-32.581818c-21.410909 5.585455-42.821818 11.170909-64.232727 11.170909-102.4 0-182.458182-69.818182-182.458182-155.461818s80.058182-155.461818 182.458182-155.461818c96.814545 0 182.458182 69.818182 182.458182 155.461818 0 47.476364-31.650909 90.298182-75.403637 122.88z" /></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1592560800799" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="18353" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M1023 629.6c0-144.8-144.9-262.7-307.5-262.7-172.3 0-307.9 118-307.9 262.7 0 145 135.7 262.7 307.9 262.7 36.1 0 72.5-9.1 108.7-18.2l99.3 54.3-27.3-90.3c72.7-54.6 126.8-126.9 126.8-208.5zM620.2 589.4c-22.7 0-41-18.4-41-41 0-22.7 18.4-41 41-41 22.7 0 41 18.4 41 41s-18.3 41-41 41z m199.3-0.3c-22.7 0-41-18.4-41-41 0-22.7 18.4-41 41-41 22.7 0 41 18.4 41 41 0 22.7-18.4 41-41 41z m0 0" fill="#00C800" p-id="18354"></path><path d="M362.1 95.3C163.1 95.3 0 231 0 403.2c0 99.5 54.2 181.1 144.9 244.5l-36.2 108.9L235.2 693.1c45.3 8.9 81.6 18.2 126.8 18.2 11.4 0 22.7-0.5 33.8-1.4-7.1-24.2-11.2-49.5-11.2-75.9 0-158.2 135.9-286.6 307.8-286.6 11.8 0 23.4 0.8 34.9 2.2C696.1 203.7 540.1 95.3 362.1 95.3zM240.5 343.7c-27.2 0-49.2-22-49.2-49.2 0-27.2 22-49.2 49.2-49.2 27.2 0 49.2 22 49.2 49.2 0 27.2-22 49.2-49.2 49.2z m252.9 0c-27.2 0-49.2-22-49.2-49.2 0-27.2 22-49.2 49.2-49.2s49.2 22 49.2 49.2c0 27.2-22 49.2-49.2 49.2z m0 0" fill="#00C800" p-id="18355"></path></svg>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="../favicon.ico">
<title>ibzuaa</title>
<script src="https://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"></script>
<script>
$(function () {
var code = getUrlParam('code');
var state = getUrlParam('state');
alert("code:" + code + "\n state:" + state);
if (code && state) {
// 通过授权code请求后台
// alert(window.location.hostname);
var opt = {"code": code, "state": state};
$.ajax({
type: "post",
url: "../uaa/queryQQUserByCode",
dataType: "json",
data: JSON.stringify(opt),
contentType: 'application/json',
success: function (data) {
// console.log(JSON.stringify(data));
if (data) {
if (data.token) {
localStorage.setItem('token', data.token);
}
if (data.user) {
localStorage.setItem('user', JSON.stringify(data.user));
}
if (data.ibzuser) {
var ibzuser = JSON.stringify(data.ibzuser);
// 设置cookie,保存账号密码7天
setCookie(ibzuser.loginname, ibzuser.password, 7);
// 跳转首页
window.location.href = "../index";
} else {
// 跳转微信绑定
window.location.href = "../#/weixinLoginRedirect?code=" + code + "&state=" + state;
}
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.readyState + XMLHttpRequest.status + XMLHttpRequest.responseText);
// 回到登录页
window.location.href = "../";
}
});
} else {
alert("微信授权登录失败!");
// 回到登录页
window.location.href = "../";
}
});
// 获取url中的参数
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]);
return null; //返回参数值
}
// 设置cookie
function setCookie(loginname, password, exdays) {
// 获取时间
let exdate = new Date();
// 保存的天数
exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays);
// 字符串拼接cookie
window.document.cookie = "loginname" + "=" + loginname + ";path=/;expires=" + exdate.toUTCString();
window.document.cookie = "password" + "=" + password + ";path=/;expires=" + exdate.toUTCString();
}
</script>
</head>
<body>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="../favicon.ico">
<title>ibzuaa</title>
<script src="https://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"></script>
<script>
$(function () {
var code = getUrlParam('code');
var state = getUrlParam('state');
// alert("code:" + code + "\n state:" + state);
if (code && state) {
// 通过授权code请求后台
// alert(window.location.hostname);
var opt = {"code": code, "state": state};
$.ajax({
type: "post",
url: "../uaa/queryWechatUserByCode",
dataType: "json",
data: JSON.stringify(opt),
contentType: 'application/json',
success: function (data) {
// console.log(JSON.stringify(data));
if (data) {
if (data.token) {
localStorage.setItem('token', data.token);
}
if (data.user) {
localStorage.setItem('user', JSON.stringify(data.user));
}
if (data.ibzuser) {
var ibzuser = JSON.stringify(data.ibzuser);
// 设置cookie,保存账号密码7天
setCookie(ibzuser.loginname, ibzuser.password, 7);
// 跳转首页
window.location.href = "../index";
} else {
// 跳转微信绑定
window.location.href = "../#/weixinLoginRedirect?code=" + code + "&state=" + state;
}
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.readyState + XMLHttpRequest.status + XMLHttpRequest.responseText);
// 回到登录页
window.location.href = "../";
}
});
} else {
alert("微信授权登录失败!");
// 回到登录页
window.location.href = "../";
}
});
// 获取url中的参数
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参数
if (r != null) return unescape(r[2]);
return null; //返回参数值
}
// 设置cookie
function setCookie(loginname, password, exdays) {
// 获取时间
let exdate = new Date();
// 保存的天数
exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays);
// 字符串拼接cookie
window.document.cookie = "loginname" + "=" + loginname + ";path=/;expires=" + exdate.toUTCString();
window.document.cookie = "password" + "=" + password + ";path=/;expires=" + exdate.toUTCString();
}
</script>
</head>
<body>
</body>
</html>
......@@ -100,14 +100,15 @@
}
.wx-svg-container,
.qq-svg-container {
.qq-svg-container,
.dd-svg-container{
display: inline-block;
width: 50px;
height: 50px;
line-height: 50px;
width: 40px;
height: 40px;
line-height: 40px;
text-align: center;
padding-top: 1px;
border-radius: 4px;
margin: 10px 3px -20px 7px;
margin: 10px 5px -20px 15px;
}
<template>
<div class='login'>
<img src="/assets/img/background.png"/>
<img src="/assets/img/background.png" draggable="false"/>
<div class='login-con'>
<card :bordered="false">
......@@ -46,7 +46,7 @@
</card>
<div class="log_footer">
<div class="copyright">
<a href="https://www.ibizlab.cn/" target="_blank">{{appTitle}} is based on ibizlab .</a>
<a href="https://www.ibizlab.cn/" target="_blank" draggable="false">{{appTitle}} is based on ibizlab .</a>
</div>
</div>
</div>
......
<template>
<div class='login'>
<img src="/assets/img/background.png"/>
<img src="/assets/img/background.png" draggable="false"/>
<div class='login-con'>
<card :bordered="false">
......@@ -62,7 +62,7 @@
</card>
<div class="log_footer">
<div class="copyright">
<a href="https://www.ibizlab.cn/" target="_blank">{{appTitle}} is based on ibizlab .</a>
<a href="https://www.ibizlab.cn/" target="_blank" draggable="false">{{appTitle}} is based on ibizlab .</a>
</div>
</div>
</div>
......
......@@ -7,7 +7,11 @@ export const globalRoutes:Array<any> = [
{
path: '/qqLoginRedirect',
component: ()=> import('@components/login/qqLoginRedirect.vue')
}
},
{
path: '/weixinLoginRedirect',
component: ()=> import('@components/login/weixinLoginRedirect.vue'),
},
];
//用户自定义首页路由
export const indexRoutes:Array<any> = [
......
......@@ -106,8 +106,18 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/syspssystems/save").permitAll()
.antMatchers("/uaa/login").permitAll()
.antMatchers("/uaa/register").permitAll()
.antMatchers("/uaa/queryUserByOpenId").permitAll()
.antMatchers("/uaa/thirdPartRegister").permitAll()
.antMatchers("/uaa/responseTokenToWeiXin").permitAll()
.antMatchers("/uaa/getWechatAppId").permitAll()
.antMatchers("/uaa/queryWechatUserByCode").permitAll()
.antMatchers("/uaa/getWechatUserInfoByCode").permitAll()
.antMatchers("/uaa/getDingtalkAppId").permitAll()
.antMatchers("/uaa/queryDingtalkUserByCode").permitAll()
.antMatchers("/uaa/queryQQUserByCode").permitAll()
.antMatchers("/uaa/getQQAppId").permitAll()
.anyRequest().authenticated()
// 防止iframe 造成跨域
.and().headers().frameOptions().disable();
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册