Skip to content

Commit 28b2ea9

Browse files
committed
fix
1 parent 4972ab0 commit 28b2ea9

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

web_src/js/features/common-page.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,12 @@ export function checkAppUrl() {
9191
showGlobalErrorMessage(`Your ROOT_URL in app.ini is "${appUrl}", it's unlikely matching the site you are visiting.
9292
Mismatched ROOT_URL config causes wrong URL links for web UI/mail content/webhook notification/OAuth2 sign-in.`, 'warning');
9393
}
94+
95+
export function checkAppUrlScheme() {
96+
const curUrl = window.location.href;
97+
// some users visit "http://domain" while appUrl is "https://domain", COOKIE_SECURE makes it impossible to sign in
98+
if (curUrl.startsWith('http:') && appUrl.startsWith('https:')) {
99+
showGlobalErrorMessage(`Your ROOT_URL in app.ini "${appUrl}" uses HTTPS, it doesn't match the HTTP site you are visiting.
100+
Mismatched ROOT_URL config would cause problems for sign-in/sign-up, etc.`, 'warning');
101+
}
102+
}

web_src/js/features/user-auth.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import {checkAppUrl} from './common-page.js';
1+
import {checkAppUrl, checkAppUrlScheme} from './common-page.ts';
22

33
export function initUserCheckAppUrl() {
44
if (!document.querySelector('.page-content.user.signin, .page-content.user.signup, .page-content.user.link-account')) return;
5-
checkAppUrl();
5+
checkAppUrlScheme();
66
}
77

88
export function initUserAuthOauth2() {
99
const outer = document.querySelector('#oauth2-login-navigator');
1010
if (!outer) return;
1111
const inner = document.querySelector('#oauth2-login-navigator-inner');
1212

13+
checkAppUrl();
14+
1315
for (const link of outer.querySelectorAll('.oauth-login-link')) {
1416
link.addEventListener('click', () => {
1517
inner.classList.add('tw-invisible');

0 commit comments

Comments
 (0)