Skip to content
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
73b7008
[fix] Show payment failure page for plan-upgrade payments #1145
pandafy Jul 16, 2026
a442348
[fix] Fixes by @coderabbita
pandafy Jul 16, 2026
fe33f6e
[fix] Fixes by @coderabbitai
pandafy Jul 17, 2026
dd7d661
[fix] Perform captive portal login when user upgrades to paid plan #1147
pandafy Jul 20, 2026
4461cba
[change] Added flow for cancelling an ongoing upgrade
pandafy Jul 20, 2026
5356460
[feature] Added captive_portal_supports_coa flag
pandafy Jul 20, 2026
04b9cc5
[fix] Fixed captive portal login flow
pandafy Jul 20, 2026
2fe11cc
[fix] Refresh radius token before attempting upgrade
pandafy Jul 20, 2026
765d828
[change] Logout user from captive portal when upgrade is abandoned
pandafy Jul 22, 2026
a5f64ed
[fix] Fixed redirect to login after captive portal login
pandafy Jul 22, 2026
191e928
[fix] Payment retry should re-login the user to captive portal
pandafy Jul 23, 2026
2b1da49
[fix] Fixed bugs
pandafy Jul 23, 2026
dc31152
[chores] Fixed test suite
pandafy Jul 25, 2026
ae3a8eb
[fix] Fixed bugs
pandafy Jul 26, 2026
f198f60
[fix] Added handling for non-destructive authMessage
pandafy Jul 26, 2026
3e96b32
[fix] Don't hide loaded on status page for authMessage
pandafy Jul 26, 2026
fafcc69
Merge remote-tracking branch 'origin/master' into fix-payment-failed-…
pandafy Sep 29, 2026
e7b2e94
[feature] Support `?next=` query param in the login url
pandafy Oct 13, 2026
9f6b7c7
[qa] Fixed docs formatting
pandafy Oct 13, 2026
21aae2e
[feature] Added aliases for query params
pandafy Oct 13, 2026
ea19528
[tests] Added browser tests for login continuation and sync auth
pandafy Oct 13, 2026
3492e3d
[feature] Added copyable payment link to /payment/draft
pandafy Oct 13, 2026
8cefe1a
[fix] Added payment return URL handling
pandafy Oct 14, 2026
6e82900
[fix] Fixed browser tests
pandafy Oct 14, 2026
1154b8e
[fix] Fixes by @coderabbitai
pandafy Oct 14, 2026
44841d9
[change] Improved copyable payment link
pandafy Oct 14, 2026
a949781
[feature] Allowed users to select the payment gateway
pandafy Oct 15, 2026
0b56799
[qa] Fixed qa errors
pandafy Oct 15, 2026
2dffad6
[tests] Fixed failing tests
pandafy Oct 15, 2026
fded425
[fix] Allow user to abandom upgrade from payment gateway selection
pandafy Oct 15, 2026
6ae1194
[change] Udpated /payment/draft message
pandafy Oct 15, 2026
8f31b1a
[fix] Fixed failing tests
pandafy Oct 15, 2026
a4f22e4
[qa] Fixed qa issues
pandafy Oct 15, 2026
1daa1a3
[fix] Fixes from review of GPT 6.1 Astra
pandafy Oct 16, 2026
edcb8de
[fix] Don't remove loader when users comes back from sync auth login
pandafy Oct 16, 2026
10e1950
[fix] Login user to captive portal after successful payment
pandafy Oct 16, 2026
cb303ba
[fix] Restore internet for payment with iframe and without internet
pandafy Oct 16, 2026
b3d85be
Merge branch 'master' into fix-payment-failed-redirect
pandafy Oct 16, 2026
37909ec
[fix] Fixed captive portal re-login
pandafy Oct 16, 2026
8c3af09
[fix] Handle payment cancellation
pandafy Oct 21, 2026
928c3ad
[chores] Updated message for cancel button
pandafy Oct 21, 2026
9391300
[fix] Restored captive portal access after payment
pandafy Oct 21, 2026
2a33c37
[chores] Fixed browser tests
pandafy Oct 21, 2026
1b815a0
[fix] Fixes by @coderabbitai
pandafy Oct 21, 2026
34a8de6
[chores] Added prefix to the captive portal logout form fields
pandafy Oct 21, 2026
cc9d312
[tests] Fixed browser tests
pandafy Oct 21, 2026
da623c9
[change] Don't enable internet mode when sycn auth is enabled
pandafy Oct 22, 2026
fad50a0
[fix] Fixes by @coderabbitai
pandafy Oct 30, 2026
d03788e
[fix] Removed blank lines and de-slopification
pandafy Oct 30, 2026
ca3468d
[chores] Addressed review feedback
pandafy Oct 30, 2026
871eb07
[chores] Addressed review feedback
pandafy Oct 30, 2026
bc57c12
[chores] Addressed review feedback
pandafy Oct 30, 2026
762c80e
[fix] Fixes by @coderabbitai
pandafy Nov 1, 2026
f6a9257
[fix] Fixes by @coderabbitai
pandafy Nov 2, 2026
d0d61f2
[fix] Fixes by @coderabbitai
pandafy Nov 2, 2026
4d2a2fd
Merge branch 'master' into fix-payment-failed-redirect
pandafy Nov 2, 2026
e0f267d
[ci] Fixes by @coderabbitai
pandafy Nov 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ jobs:

- name: Get openwisp-radius
run: |
git clone --depth=1 https://github.com/openwisp/openwisp-radius/ openwisp-radius
# TODO: switch back to master once the captive portal mock
# redirect is merged in openwisp-radius
git clone --depth=1 --branch captive-portal-mock-redirect https://github.com/openwisp/openwisp-radius/ openwisp-radius
cd openwisp-radius
echo "OpenWISP RADIUS commit: $(git rev-parse HEAD)"
echo "OW_RADIUS_VERSION=$(git rev-parse HEAD)" >> $GITHUB_ENV
Expand Down Expand Up @@ -149,8 +151,8 @@ jobs:
pip install -e ".[saml]"
./tests/manage.py migrate

- name: Creating configuration of organization (supports mobile verification)
run: node browser-test/create-mobile-configuration.js
- name: Creating configuration of organizations (mobile verification and sync auth)
run: node browser-test/create-test-organizations.js
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

- name: Run OpenWISP WiFi Login Pages dev server
run: yarn start &
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ server/assets/*
!client/assets/warning.svg
!client/assets/data.svg
!client/assets/timer.svg
!client/assets/copy.svg
!client/assets/fonts/
client/translations/
i18n/*
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Core code lives in this repository root:
- `client/` contains React UI, client utilities, styles, and tests.
- `server/` contains the Node.js server, routes, controllers, and utilities.
- `browser-test/` contains end-to-end browser tests.
- `openwisp-radius/` is a temporary checkout used only for browser tests. Changes there are out of scope; report and ignore changes from `openwisp-qa-format`, `yarn format`, or `yarn lint`. Do not delete, reset, or revert it.
- `organizations/`, `config/`, `i18n/`, `public/`, and `scripts/` provide tenant configuration, translations, assets, and tooling.
- `docs/` is incorporated into the unified, versioned OpenWISP documentation built by `openwisp-docs`, not a standalone site; use `docs/user/` for end users and `docs/developer/` for contributors and developers of extensions, downstream, or derivative apps.
- `dist/`, generated configuration, organization assets, and translations contain build output.
Expand Down
4 changes: 4 additions & 0 deletions browser-test/browser_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@
def cleanup_test_data(test_data):
mobile_data = test_data["mobileVerificationTestUser"]
cross_org_data = test_data["crossOrgPhoneVerificationUser"]
sync_auth_data = test_data["syncAuthTestUser"]
User.objects.filter(username=test_data["testuser"]["email"]).delete()
User.objects.filter(username=test_data["expiredPasswordUser"]["email"]).delete()
User.objects.filter(username=cross_org_data["phoneNumber"]).delete()
User.objects.filter(username=mobile_data["phoneNumber"]).delete()
User.objects.filter(username=mobile_data["changePhoneNumber"]).delete()
User.objects.filter(username=sync_auth_data["email"]).delete()
Organization.objects.filter(name=mobile_data["organization"]).delete()
Organization.objects.filter(name=sync_auth_data["organization"]).delete()
RadiusAccounting.objects.filter(username=test_data["testuser"]["email"]).delete()
RadiusAccounting.objects.filter(username=cross_org_data["phoneNumber"]).delete()
RadiusAccounting.objects.filter(username=sync_auth_data["email"]).delete()
122 changes: 122 additions & 0 deletions browser-test/captive-portal-sync-auth.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import {until} from "selenium-webdriver";
import {
baseUrl,
getDriver,
getElementByCss,
urls,
initialData,
initializeData,
tearDown,
successToastSelector,
} from "./utils";

// The marker is lost only when the browser leaves the single page app,
// which proves the captive portal form was submitted in the top-level window.
const setMarker = (driver) =>
driver.executeScript("window.syncAuthMarker = true");
const waitForMarkerLoss = (driver) =>
driver.wait(
async () => !(await driver.executeScript("return window.syncAuthMarker")),
10000,
);

describe("Selenium tests for synchronous captive portal authentication", () => {
let driver;

beforeAll(async () => {
await initializeData("syncAuth");
driver = await getDriver();
}, 30000);

afterAll(async () => {
await tearDown(driver);
});

it("should login and logout through the captive portal in the top-level window", async () => {
const data = initialData().syncAuthTestUser;
const loginUrl = urls.verificationLogin(data.organization);
await driver.get(loginUrl);
await setMarker(driver);
const username = await getElementByCss(driver, "input#username");
await username.sendKeys(data.email);
const password = await getElementByCss(driver, "input#password");
await password.sendKeys(data.password);
const submitBtn = await getElementByCss(driver, "input[type=submit]");
await submitBtn.click();
await waitForMarkerLoss(driver);
await driver.wait(
until.urlIs(`${baseUrl}/${data.organization}/status`),
10000,
);
const loginForm = await getElementByCss(driver, "#cp-login-form");
expect(await loginForm.getAttribute("target")).toEqual("_self");
const loginRedirect = await getElementByCss(
driver,
"#cp-login-form input[name=redirurl]",
);
expect(await loginRedirect.getAttribute("value")).toEqual(
`${baseUrl}/${data.organization}/status`,
);
const emailElement = await getElementByCss(
driver,
"#status .main-column > .inner > p:nth-child(5) > span",
);
await driver.wait(until.elementTextIs(emailElement, data.email));
// the active session is created by the captive portal mock login view
const activeSessionTr = await getElementByCss(
driver,
"table tr.active-session",
);
await driver.wait(until.elementIsVisible(activeSessionTr));
const logoutRedirect = await getElementByCss(
driver,
"#cp-logout-form input[name=redirurl]",
);
expect(await logoutRedirect.getAttribute("value")).toEqual(
`${baseUrl}/${data.organization}/status`,
);
await setMarker(driver);
const logoutBtn = await getElementByCss(driver, ".logout input.button");
await logoutBtn.click();
const noBtn = await getElementByCss(
driver,
".modal.is-visible .modal-buttons button:nth-child(2)",
);
await driver.wait(until.elementIsVisible(noBtn));
await noBtn.click();
await waitForMarkerLoss(driver);
await driver.wait(until.urlIs(loginUrl), 10000);
const successToastDiv = await getElementByCss(driver, successToastSelector);
await driver.wait(until.elementIsVisible(successToastDiv));
expect(await successToastDiv.getText()).toEqual("Logout successful");
});

it("should follow the login continuation after the captive portal redirect", async () => {
const data = initialData().syncAuthTestUser;
const destination = `/${data.organization}/change-password`;
await driver.get(
`${urls.verificationLogin(data.organization)}?${new URLSearchParams({next: destination})}`,
);
const username = await getElementByCss(driver, "input#username");
await username.sendKeys(data.email);
const password = await getElementByCss(driver, "input#password");
await password.sendKeys(data.password);
await setMarker(driver);
const submitBtn = await getElementByCss(driver, "input[type=submit]");
await submitBtn.click();
await waitForMarkerLoss(driver);
await driver.wait(until.urlIs(`${baseUrl}${destination}`), 10000);
await getElementByCss(driver, "#password-change");
expect(
await driver.executeScript(
"return window.sessionStorage.getItem('ow_continuation');",
),
).toEqual(null);
await driver.get(`${baseUrl}/${data.organization}/status`);
const activeSessionTr = await getElementByCss(
driver,
"table tr.active-session",
);
await driver.wait(until.elementIsVisible(activeSessionTr));
});
});
64 changes: 0 additions & 64 deletions browser-test/create-mobile-configuration.js

This file was deleted.

89 changes: 89 additions & 0 deletions browser-test/create-test-organizations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/* eslint-disable camelcase */
const child_process = require("child_process");
const path = require("path");
const fs = require("fs");
const yaml = require("js-yaml");
const data = require("./testData.json");

const writeOutput = (result) => {
if (result.stdout) {
process.stdout.write(`${result.stdout}\n`);
}
if (result.stderr) {
process.stderr.write(`${result.stderr}\n`);
}
if (result.status !== 0) {
process.exit(result.status);
}
};

const jsDir = path.resolve(__dirname, "../organizations/js");

const createOrganization = (org, extraOptions, editConfig) => {
const configDirPath = path.resolve(__dirname, `../organizations/${org}`);
const configPath = path.join(configDirPath, `${org}.yml`);
if (fs.existsSync(configDirPath)) {
fs.rmSync(configDirPath, {recursive: true});
}
const options = {
name: org,
slug: org,
uuid: "organization_uuid",
secret_key: "organization_secret_key",
mobile_phone_verification: false,
subscriptions: false,
login_action_url: "http://localhost:8000/captive-portal-mock/login/",
logout_action_url: "http://localhost:8000/captive-portal-mock/logout/",
logout_by_session_ID: true,
remember_me: true,
openwisp_radius_url: "http://127.0.0.1:8000",
assets_confirm: true,
...extraOptions,
};
const result = child_process.spawnSync("yarn", [
"add-org",
"--noprompt",
JSON.stringify(options),
]);
writeOutput(result);
const content = yaml.load(fs.readFileSync(configPath, "utf8"));
editConfig(content, options);
fs.writeFileSync(configPath, yaml.dump(content));
};

try {
createOrganization(
data.mobileVerificationTestUser.organization,
{mobile_phone_verification: true},
(content) => {
Object.assign(content, {server: {...content.server, timeout: 5}});
const {client} = content;
client.languages = [
{text: "english", slug: "en"},
{text: "italiano", slug: "it"},
];
},
);
const syncAuthOrg = data.syncAuthTestUser.organization;
createOrganization(syncAuthOrg, {}, (content, options) => {
const {components} = content.client;
// The redirurl host must match the one used by the browser tests,
// otherwise WLP cookies and localStorage are lost after the redirect.
const redirurl = () => [
{name: "redirurl", value: `http://127.0.0.1:8080/${syncAuthOrg}/status`},
];
components.captive_portal_sync_auth = true;
components.captive_portal_login_form = {
...components.captive_portal_login_form,
additional_fields: redirurl(),
};
components.captive_portal_logout_form = {
...components.captive_portal_logout_form,
action: options.logout_action_url,
additional_fields: redirurl(),
};
});
fs.writeFileSync(path.join(jsDir, data.allOrgScript), "");
} catch (err) {
console.log(err);
}
36 changes: 34 additions & 2 deletions browser-test/initialize_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def load_test_data():
registration_tests = "register" in sys.argv
create_mobile_verification_org = "mobileVerification" in sys.argv
cross_org_phone_verification_tests = "crossOrgPhoneVerification" in sys.argv
expired_password_tests = "expiredPassword" in sys.argv
continuation_tests = "continuation" in sys.argv
expired_password_tests = "expiredPassword" in sys.argv or continuation_tests
sync_auth_tests = "syncAuth" in sys.argv

sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, os.path.join(OPENWISP_RADIUS_PATH, "tests"))
Expand All @@ -42,6 +44,7 @@ def load_test_data():
from browser_test_utils import cleanup_test_data # relative import
from django.contrib.auth import get_user_model
from django.utils.timezone import now, timedelta
from sesame.utils import get_token
from swapper import load_model

User = get_user_model()
Expand Down Expand Up @@ -118,9 +121,20 @@ def load_test_data():
else:
OrganizationUser.objects.create(organization=source_org, user=cross_org_user)
RegisteredUser.objects.create(
user=cross_org_user, method=data["method"], is_verified=True, organization=source_org
user=cross_org_user,
method=data["method"],
is_verified=True,
organization=source_org,
)

if sync_auth_tests:
data = test_data["syncAuthTestUser"]
sync_auth_org = Organization.objects.create(name=data["organization"])
OrganizationRadiusSettings.objects.create(organization=sync_auth_org)
sync_auth_user = User.objects.create_user(
username=data["email"], password=data["password"], email=data["email"]
)
OrganizationUser.objects.create(organization=sync_auth_org, user=sync_auth_user)

try:
org = Organization.objects.get(slug=test_user_organization)
Expand Down Expand Up @@ -149,3 +163,21 @@ def load_test_data():
password_updated=now().date() - timedelta(days=180),
)
OrganizationUser.objects.create(organization=org, user=expired_password_user)

if continuation_tests:
RegisteredUser.objects.create(
user=user, organization=org, method="email", is_verified=True
)
fixtures = {}
for key, fixture_user in [
("testuser", user),
("expiredPasswordUser", expired_password_user),
]:
fixtures[key] = {
"username": fixture_user.username,
"email": fixture_user.email,
"password": test_data[key]["password"],
"token": get_token(fixture_user),
}
# printed on the last line, which is parsed by the browser tests
print(json.dumps(fixtures))
Loading
Loading