1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-18 16:28:36 +00:00

Warn users when they try to use a non-root-url to sign in/up (#32272) (#32273)

This commit is contained in:
wxiaoguang
2024-10-17 09:01:44 +08:00
committed by GitHub
parent db7349bc0d
commit 7e0fd4c208
3 changed files with 16 additions and 2 deletions

View File

@@ -453,3 +453,11 @@ export function checkAppUrl() {
showGlobalErrorMessage(`Your ROOT_URL in app.ini is "${appUrl}", it's unlikely matching the site you are visiting.
Mismatched ROOT_URL config causes wrong URL links for web UI/mail content/webhook notification/OAuth2 sign-in.`, 'warning');
}
export function checkAppUrlScheme() {
const curUrl = window.location.href;
// some users visit "http://domain" while appUrl is "https://domain", COOKIE_SECURE makes it impossible to sign in
if (curUrl.startsWith('http:') && appUrl.startsWith('https:')) {
showGlobalErrorMessage(`This instance is configured to run under HTTPS (by ROOT_URL config), you are accessing by HTTP. Mismatched scheme might cause problems for sign-in/sign-up.`, 'warning');
}
}