Skip to content

Commit baf50cf

Browse files
committed
Merge remote-tracking branch 'origin/candidate-8.12.x' into candidate-9.0.x
Signed-off-by: Gordon Smith <[email protected]> # Conflicts: # helm/hpcc/Chart.yaml # helm/hpcc/templates/_helpers.tpl # helm/hpcc/templates/dafilesrv.yaml # helm/hpcc/templates/dali.yaml # helm/hpcc/templates/dfuserver.yaml # helm/hpcc/templates/eclagent.yaml # helm/hpcc/templates/eclccserver.yaml # helm/hpcc/templates/eclscheduler.yaml # helm/hpcc/templates/esp.yaml # helm/hpcc/templates/localroxie.yaml # helm/hpcc/templates/roxie.yaml # helm/hpcc/templates/sasha.yaml # helm/hpcc/templates/thor.yaml # version.cmake
2 parents ec0bf91 + df6ad30 commit baf50cf

13 files changed

+17
-29
lines changed

esp/src/Login.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
var d = new Date();
144144
d.setTime(d.getTime() + (exMins * 60 * 1000));
145145
var expires = "expires=" + d.toUTCString();
146-
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
146+
document.cookie = cname + "=" + cvalue + ";" + expires + ";";
147147
}
148148

149149
if (document.cookie.indexOf("ESPAuthenticationMSG") > -1) {

esp/src/eclwatch/HPCCPlatformWidget.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ define([
253253
context.checkIfAdmin(context.userName);
254254
context.refreshUserName();
255255
if (!cookie("PasswordExpiredCheck")) {
256-
cookie("PasswordExpiredCheck", "true", { expires: 1 });
256+
cookie("PasswordExpiredCheck", "true", { expires: 1, path: "/" });
257257
if (lang.exists("MyAccountResponse.passwordDaysRemaining", response)) {
258258
switch (response.MyAccountResponse.passwordDaysRemaining) {
259259
case null:

esp/src/eclwatch/LockDialogWidget.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ define([
5858
show: function (event) {
5959
var context = this;
6060
if (!dojoConfig.username) {
61-
cookie("Status", "Unlocked");
6261
context.storage.setItem("Status", "Unlocked");
6362
topic.publish("hpcc/session_management_status", {
6463
status: "Unlocked"
@@ -96,7 +95,6 @@ define([
9695
var context = this;
9796

9897
if (this.unlockForm.validate()) {
99-
cookie("Status", "login_attempt");
10098
WsAccount.Unlock({
10199
request: {
102100
username: this.unlockUserName.get("value"),
@@ -113,7 +111,6 @@ define([
113111
topic.publish("hpcc/session_management_status", {
114112
status: "Unlocked"
115113
});
116-
cookie("Status", "Unlocked");
117114
context.storage.setItem("Status", "Unlocked");
118115
if (context.idleFired) {
119116
dojo.publish("hpcc/brToaster", {
@@ -127,7 +124,6 @@ define([
127124
}
128125
} else {
129126
context.unlockStatus.innerHTML = response.UnlockResponse.Message;
130-
cookie("Status", "Locked");
131127
}
132128
});
133129
}
@@ -150,10 +146,9 @@ define([
150146
topic.publish("hpcc/session_management_status", {
151147
status: "Locked"
152148
});
153-
cookie("Status", "Locked");
154149
context.storage.setItem("Status", "Locked");
155-
} else if (cookie("Status") === "Unlocked") {
156-
xhr("esp/lock", {
150+
} else {
151+
xhr("/esp/lock", {
157152
method: "post"
158153
}).then(function (response) {
159154
if (response) {
@@ -163,7 +158,6 @@ define([
163158
topic.publish("hpcc/session_management_status", {
164159
status: "Locked"
165160
});
166-
cookie("Status", "Locked");
167161
context.storage.setItem("Status", "Locked");
168162
}
169163
});

esp/src/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
}
3939

4040
function checkCookie() {
41-
document.cookie.indexOf("ESPAuthenticated=true") > -1 ? window.location.href : window.location.href = location.origin + "#/login";
41+
document.cookie.indexOf("ESPAuthenticated=true") > -1 ? window.location.href : window.location.href = location.origin + "/esp/files/Login.html";
4242
}
4343

4444
function sendAuthRequest() {

esp/src/lws.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ let rewrite = [
3838
{ from: "/esp/files/dist/(.*)", to: "/build/dist/$1" },
3939
{ from: "/esp/files/img/(.*)", to: "build/esp/files/img/$1" },
4040
{ from: "/esp/files/(.*/*.css)", to: "/build/esp/files/$1" },
41-
{ from: "/esp/files/(.*)", to: "/$1" },
41+
{ from: "/esp/files/(.*)", to: "/build/$1" },
4242
{ from: "/main", to: protocol + "://" + ip + ":" + port + "/main" },
4343
{ from: "/FileSpray/(.*)", to: protocol + "://" + ip + ":" + port + "/FileSpray/$1" },
4444
{ from: "/WsCloud/(.*)", to: protocol + "://" + ip + ":" + port + "/WsCloud/$1" },

esp/src/src-react/components/Frame.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const Frame: React.FunctionComponent<FrameProps> = () => {
6565
fireIdle();
6666
} else if (publishedMessage.status === "Idle") {
6767
window.localStorage.setItem("pageOnLock", window.location.hash.substring(1));
68-
setUserSession({ ...userSession, Status: "Locked" });
68+
setUserSession({ ...userSession });
6969
window.location.reload();
7070
}
7171
});

esp/src/src-react/components/Title.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ export const DevTitle: React.FunctionComponent<DevTitleProps> = ({
136136
{ key: "divider_2", itemType: ContextualMenuItemType.Divider },
137137
{
138138
key: "lock", text: nlsHPCC.Lock, disabled: !currentUser?.username, onClick: () => {
139-
fetch("esp/lock", {
139+
fetch("/esp/lock", {
140140
method: "post"
141141
}).then(() => {
142-
setUserSession({ ...userSession, Status: "Locked" });
142+
setUserSession({ ...userSession });
143143
replaceUrl("/login", null, true);
144144
});
145145
}
@@ -232,7 +232,7 @@ export const DevTitle: React.FunctionComponent<DevTitleProps> = ({
232232
if (!currentUser.username) return;
233233
if (!cookie("PasswordExpiredCheck")) {
234234
// cookie expires option expects whole number of days, use a decimal < 1 for hours
235-
cookie("PasswordExpiredCheck", "true", { expires: 0.5 });
235+
cookie("PasswordExpiredCheck", "true", { expires: 0.5, path: "/" });
236236
if (currentUser.passwordIsExpired) {
237237
alert(nlsHPCC.PasswordExpired);
238238
setShowMyAccount(true);

esp/src/src-react/components/forms/Login.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ export const Login: React.FunctionComponent<LoginProps> = ({
116116
setErrorMessage(cookies.ESPAuthenticationMSG);
117117
setShowError(true);
118118
} else {
119-
cookies["Status"] = "Unlocked";
120119
cookies["ESPAuthenticated"] = "true";
121120
createUserSession(cookies).then(() => {
122121
setErrorMessage("");

esp/src/src-react/hooks/user.ts

-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const defaults = {
77
ESPSessionTimeout: 7200,
88
ESPAuthenticated: false,
99
ECLWatchUser: false,
10-
Status: "Unlocked",
1110
ESPSessionState: false
1211
};
1312

@@ -17,7 +16,6 @@ export interface UserSession {
1716
ESPSessionTimeout: number;
1817
ESPAuthenticated: boolean;
1918
ECLWatchUser: boolean;
20-
Status: string;
2119
ESPAuthenticationMSG?: string;
2220
ESPSessionState: boolean;
2321
}
@@ -56,7 +54,6 @@ export function useUserSession(): {
5654
default:
5755
store.set("ESPSessionState", "false");
5856
}
59-
store.set("Status", "Unlocked");
6057
store.set("ECLWatchUser", "true");
6158
}).catch(err => {
6259
store.set("ESPSessionState", "false");

esp/src/src-react/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async function loadUI() {
4343
const authType = await authTypeResp?.text() ?? "None";
4444
const userStore = cookieKeyValStore();
4545
const userSession = await userStore.getAll();
46-
if (authType.indexOf("None") < 0 && (userSession["ESPSessionState"] === "false" || userSession["ECLWatchUser"] === "false" || (!userSession["Status"] || userSession["Status"] === "Locked"))) {
46+
if (authType.indexOf("None") < 0 && (userSession["ESPSessionState"] === "false" || userSession["ECLWatchUser"] === "false")) {
4747
if (window.location.hash.indexOf("login") < 0) {
4848
replaceUrl("/login");
4949
}

esp/src/src/ESPRequest.ts

-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ class RequestHelper {
122122
status: "DoIdle"
123123
});
124124
}
125-
cookie("Status", "Locked");
126125
ESPUtil.LocalStorage.removeItem("Status");
127126
}
128127
}

esp/src/src/Session.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import * as xhr from "dojo/request/xhr";
33
import * as topic from "dojo/topic";
44
import { format as d3Format } from "@hpcc-js/common";
55
import { SMCService } from "@hpcc-js/comms";
6+
import { scopedLogger } from "@hpcc-js/util";
67
import { cookieKeyValStore, sessionKeyValStore, userKeyValStore } from "src/KeyValStore";
78
import { singletonDebounce } from "../src-react/util/throttle";
89
import { parseSearch } from "../src-react/util/history";
910
import { ModernMode } from "./BuildInfo";
1011
import * as ESPUtil from "./ESPUtil";
11-
import { scopedLogger } from "@hpcc-js/util";
1212

1313
const logger = scopedLogger("src/Session.ts");
1414

@@ -43,6 +43,10 @@ export async function needsRedirectV5(): Promise<boolean> {
4343
window.location.replace(`/esp/files/index.html${window.location.hash}`);
4444
return true;
4545
}
46+
if (window.location.pathname.indexOf("/esp/files/stub.htm") < 0) {
47+
window.location.replace(`/esp/files/stub.htm${window.location.search}${window.location.hash}`);
48+
return true;
49+
}
4650
if (isV5DirectURL()) {
4751
return false;
4852
}
@@ -141,21 +145,16 @@ export function initSession() {
141145
});
142146

143147
idleWatcher.start();
144-
if (!cookie("Status")) {
145-
document.cookie = "Status=Unlocked;Path=/";
146-
}
147148
} else if (cookie("ECLWatchUser")) {
148149
window.location.replace(dojoConfig.urlInfo.basePath + "/Login.html");
149150
}
150151
}
151152

152153
export function lock() {
153-
cookie("Status", "Locked");
154154
idleWatcher.stop();
155155
}
156156

157157
export function unlock() {
158-
cookie("Status", "Unlocked");
159158
idleWatcher.start();
160159
}
161160

esp/src/src/Utility.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ export function parseCookies(): Record<string, any> {
10741074
export function deleteCookie(name: string) {
10751075
const expireDate = new Date();
10761076
expireDate.setSeconds(expireDate.getSeconds() + 1);
1077-
document.cookie = `${name}=; domain=${window.location.hostname}; path=/; expires=${expireDate.toUTCString()}`;
1077+
document.cookie = `${name}=; domain=${window.location.hostname}; expires=${expireDate.toUTCString()}`;
10781078
}
10791079

10801080
const d3FormatDecimal = d3Format(",.2f");

0 commit comments

Comments
 (0)