Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/candidate-8.12.x' into candidate…
Browse files Browse the repository at this point in the history
…-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
  • Loading branch information
GordonSmith committed Apr 10, 2024
2 parents ec0bf91 + df6ad30 commit baf50cf
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 29 deletions.
2 changes: 1 addition & 1 deletion esp/src/Login.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
var d = new Date();
d.setTime(d.getTime() + (exMins * 60 * 1000));
var expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
document.cookie = cname + "=" + cvalue + ";" + expires + ";";
}

if (document.cookie.indexOf("ESPAuthenticationMSG") > -1) {
Expand Down
2 changes: 1 addition & 1 deletion esp/src/eclwatch/HPCCPlatformWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ define([
context.checkIfAdmin(context.userName);
context.refreshUserName();
if (!cookie("PasswordExpiredCheck")) {
cookie("PasswordExpiredCheck", "true", { expires: 1 });
cookie("PasswordExpiredCheck", "true", { expires: 1, path: "/" });
if (lang.exists("MyAccountResponse.passwordDaysRemaining", response)) {
switch (response.MyAccountResponse.passwordDaysRemaining) {
case null:
Expand Down
10 changes: 2 additions & 8 deletions esp/src/eclwatch/LockDialogWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ define([
show: function (event) {
var context = this;
if (!dojoConfig.username) {
cookie("Status", "Unlocked");
context.storage.setItem("Status", "Unlocked");
topic.publish("hpcc/session_management_status", {
status: "Unlocked"
Expand Down Expand Up @@ -96,7 +95,6 @@ define([
var context = this;

if (this.unlockForm.validate()) {
cookie("Status", "login_attempt");
WsAccount.Unlock({
request: {
username: this.unlockUserName.get("value"),
Expand All @@ -113,7 +111,6 @@ define([
topic.publish("hpcc/session_management_status", {
status: "Unlocked"
});
cookie("Status", "Unlocked");
context.storage.setItem("Status", "Unlocked");
if (context.idleFired) {
dojo.publish("hpcc/brToaster", {
Expand All @@ -127,7 +124,6 @@ define([
}
} else {
context.unlockStatus.innerHTML = response.UnlockResponse.Message;
cookie("Status", "Locked");
}
});
}
Expand All @@ -150,10 +146,9 @@ define([
topic.publish("hpcc/session_management_status", {
status: "Locked"
});
cookie("Status", "Locked");
context.storage.setItem("Status", "Locked");
} else if (cookie("Status") === "Unlocked") {
xhr("esp/lock", {
} else {
xhr("/esp/lock", {
method: "post"
}).then(function (response) {
if (response) {
Expand All @@ -163,7 +158,6 @@ define([
topic.publish("hpcc/session_management_status", {
status: "Locked"
});
cookie("Status", "Locked");
context.storage.setItem("Status", "Locked");
}
});
Expand Down
2 changes: 1 addition & 1 deletion esp/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}

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

function sendAuthRequest() {
Expand Down
2 changes: 1 addition & 1 deletion esp/src/lws.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let rewrite = [
{ from: "/esp/files/dist/(.*)", to: "/build/dist/$1" },
{ from: "/esp/files/img/(.*)", to: "build/esp/files/img/$1" },
{ from: "/esp/files/(.*/*.css)", to: "/build/esp/files/$1" },
{ from: "/esp/files/(.*)", to: "/$1" },
{ from: "/esp/files/(.*)", to: "/build/$1" },
{ from: "/main", to: protocol + "://" + ip + ":" + port + "/main" },
{ from: "/FileSpray/(.*)", to: protocol + "://" + ip + ":" + port + "/FileSpray/$1" },
{ from: "/WsCloud/(.*)", to: protocol + "://" + ip + ":" + port + "/WsCloud/$1" },
Expand Down
2 changes: 1 addition & 1 deletion esp/src/src-react/components/Frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const Frame: React.FunctionComponent<FrameProps> = () => {
fireIdle();
} else if (publishedMessage.status === "Idle") {
window.localStorage.setItem("pageOnLock", window.location.hash.substring(1));
setUserSession({ ...userSession, Status: "Locked" });
setUserSession({ ...userSession });
window.location.reload();
}
});
Expand Down
6 changes: 3 additions & 3 deletions esp/src/src-react/components/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ export const DevTitle: React.FunctionComponent<DevTitleProps> = ({
{ key: "divider_2", itemType: ContextualMenuItemType.Divider },
{
key: "lock", text: nlsHPCC.Lock, disabled: !currentUser?.username, onClick: () => {
fetch("esp/lock", {
fetch("/esp/lock", {
method: "post"
}).then(() => {
setUserSession({ ...userSession, Status: "Locked" });
setUserSession({ ...userSession });
replaceUrl("/login", null, true);
});
}
Expand Down Expand Up @@ -232,7 +232,7 @@ export const DevTitle: React.FunctionComponent<DevTitleProps> = ({
if (!currentUser.username) return;
if (!cookie("PasswordExpiredCheck")) {
// cookie expires option expects whole number of days, use a decimal < 1 for hours
cookie("PasswordExpiredCheck", "true", { expires: 0.5 });
cookie("PasswordExpiredCheck", "true", { expires: 0.5, path: "/" });
if (currentUser.passwordIsExpired) {
alert(nlsHPCC.PasswordExpired);
setShowMyAccount(true);
Expand Down
1 change: 0 additions & 1 deletion esp/src/src-react/components/forms/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ export const Login: React.FunctionComponent<LoginProps> = ({
setErrorMessage(cookies.ESPAuthenticationMSG);
setShowError(true);
} else {
cookies["Status"] = "Unlocked";
cookies["ESPAuthenticated"] = "true";
createUserSession(cookies).then(() => {
setErrorMessage("");
Expand Down
3 changes: 0 additions & 3 deletions esp/src/src-react/hooks/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const defaults = {
ESPSessionTimeout: 7200,
ESPAuthenticated: false,
ECLWatchUser: false,
Status: "Unlocked",
ESPSessionState: false
};

Expand All @@ -17,7 +16,6 @@ export interface UserSession {
ESPSessionTimeout: number;
ESPAuthenticated: boolean;
ECLWatchUser: boolean;
Status: string;
ESPAuthenticationMSG?: string;
ESPSessionState: boolean;
}
Expand Down Expand Up @@ -56,7 +54,6 @@ export function useUserSession(): {
default:
store.set("ESPSessionState", "false");
}
store.set("Status", "Unlocked");
store.set("ECLWatchUser", "true");
}).catch(err => {
store.set("ESPSessionState", "false");
Expand Down
2 changes: 1 addition & 1 deletion esp/src/src-react/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function loadUI() {
const authType = await authTypeResp?.text() ?? "None";
const userStore = cookieKeyValStore();
const userSession = await userStore.getAll();
if (authType.indexOf("None") < 0 && (userSession["ESPSessionState"] === "false" || userSession["ECLWatchUser"] === "false" || (!userSession["Status"] || userSession["Status"] === "Locked"))) {
if (authType.indexOf("None") < 0 && (userSession["ESPSessionState"] === "false" || userSession["ECLWatchUser"] === "false")) {
if (window.location.hash.indexOf("login") < 0) {
replaceUrl("/login");
}
Expand Down
1 change: 0 additions & 1 deletion esp/src/src/ESPRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ class RequestHelper {
status: "DoIdle"
});
}
cookie("Status", "Locked");
ESPUtil.LocalStorage.removeItem("Status");
}
}
Expand Down
11 changes: 5 additions & 6 deletions esp/src/src/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import * as xhr from "dojo/request/xhr";
import * as topic from "dojo/topic";
import { format as d3Format } from "@hpcc-js/common";
import { SMCService } from "@hpcc-js/comms";
import { scopedLogger } from "@hpcc-js/util";
import { cookieKeyValStore, sessionKeyValStore, userKeyValStore } from "src/KeyValStore";
import { singletonDebounce } from "../src-react/util/throttle";
import { parseSearch } from "../src-react/util/history";
import { ModernMode } from "./BuildInfo";
import * as ESPUtil from "./ESPUtil";
import { scopedLogger } from "@hpcc-js/util";

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

Expand Down Expand Up @@ -43,6 +43,10 @@ export async function needsRedirectV5(): Promise<boolean> {
window.location.replace(`/esp/files/index.html${window.location.hash}`);
return true;
}
if (window.location.pathname.indexOf("/esp/files/stub.htm") < 0) {
window.location.replace(`/esp/files/stub.htm${window.location.search}${window.location.hash}`);
return true;
}
if (isV5DirectURL()) {
return false;
}
Expand Down Expand Up @@ -141,21 +145,16 @@ export function initSession() {
});

idleWatcher.start();
if (!cookie("Status")) {
document.cookie = "Status=Unlocked;Path=/";
}
} else if (cookie("ECLWatchUser")) {
window.location.replace(dojoConfig.urlInfo.basePath + "/Login.html");
}
}

export function lock() {
cookie("Status", "Locked");
idleWatcher.stop();
}

export function unlock() {
cookie("Status", "Unlocked");
idleWatcher.start();
}

Expand Down
2 changes: 1 addition & 1 deletion esp/src/src/Utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ export function parseCookies(): Record<string, any> {
export function deleteCookie(name: string) {
const expireDate = new Date();
expireDate.setSeconds(expireDate.getSeconds() + 1);
document.cookie = `${name}=; domain=${window.location.hostname}; path=/; expires=${expireDate.toUTCString()}`;
document.cookie = `${name}=; domain=${window.location.hostname}; expires=${expireDate.toUTCString()}`;
}

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

0 comments on commit baf50cf

Please sign in to comment.