增加Token管理模块(仅限于redis token模式):"认证管理-token管理"
This commit is contained in:
@@ -84,7 +84,7 @@ layui.define(['config', 'layer'], function (exports) {
|
||||
return layer.open(param);
|
||||
},
|
||||
// 封装ajax请求,返回数据类型为json
|
||||
req: function (url, data, success, method) {
|
||||
req: function (url, data, success, method, noHeaderToken) {
|
||||
if ('put' == method.toLowerCase()) {
|
||||
method = 'PUT';
|
||||
} else if ('delete' == method.toLowerCase()) {
|
||||
@@ -99,9 +99,11 @@ layui.define(['config', 'layer'], function (exports) {
|
||||
contentType: "application/json",
|
||||
success: success,
|
||||
beforeSend: function (xhr) {
|
||||
var token = config.getToken();
|
||||
if (token) {
|
||||
xhr.setRequestHeader('Authorization', 'bearer ' + token.access_token);
|
||||
if (!noHeaderToken) {
|
||||
let token = config.getToken();
|
||||
if (token) {
|
||||
xhr.setRequestHeader('Authorization', 'bearer ' + token.access_token);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -217,7 +217,7 @@ layui.define(['config', 'admin', 'layer', 'laytpl', 'element', 'form'], function
|
||||
$('#btnLogout').click(function () {
|
||||
layer.confirm('确定退出登录?', function () {
|
||||
//通过认证中心 tuic
|
||||
admin.req('api-uaa/oauth/remove/token?access_token='+config.getToken().access_token, {}, function (data) {
|
||||
admin.req('api-uaa/oauth/remove/token', {}, function (data) {
|
||||
config.removeToken();
|
||||
location.replace('login.html');
|
||||
}, 'POST');
|
||||
|
||||
Reference in New Issue
Block a user