mirror of
https://github.com/apache/rocketmq-dashboard.git
synced 2026-06-06 03:43:19 +08:00
Add frontend session check logic
This commit is contained in:
@@ -37,14 +37,6 @@ var app = angular.module('app', [
|
||||
if (initFlag) return;
|
||||
initFlag = true;
|
||||
|
||||
//TODO: make the session timeout consistent with backend
|
||||
// var sessionId = $cookies.get("JSESSIONID");
|
||||
// console.log("sessionId "+ sessionId);
|
||||
//
|
||||
// if (sessionId === undefined || sessionId == null) {
|
||||
// $window.sessionStorage.clear();
|
||||
// }
|
||||
|
||||
var url = '/login/check.query';
|
||||
var setting = {
|
||||
type: "GET",
|
||||
@@ -62,7 +54,11 @@ var app = angular.module('app', [
|
||||
init(function(resp){
|
||||
if (resp.status == 0) {
|
||||
// console.log('resp.data==='+resp.data);
|
||||
loginFlag = resp.data;
|
||||
var loginInfo = resp.data;
|
||||
loginFlag = loginInfo.loginRequired;
|
||||
if (!loginInfo.logined) {
|
||||
$window.sessionStorage.clear();
|
||||
}
|
||||
}else {
|
||||
Notification.error({message: "" + resp.errMsg, delay: 2000});
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ app.controller('loginController', ['$scope','$location','$http','Notification','
|
||||
if (resp.status == 0) {
|
||||
Notification.info({message: 'Login successful, redirect now', delay: 2000});
|
||||
$window.sessionStorage.setItem("username", $("#username").val());
|
||||
//alert("XXXXX resp.data="+resp.data.sessionId);
|
||||
//$window.sessionStorage.setItem("sessionId", resp.data.sessionId);
|
||||
window.location = "/";
|
||||
initFlag = false;
|
||||
} else{
|
||||
|
||||
Reference in New Issue
Block a user