File tree Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Expand file tree Collapse file tree 3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -453,3 +453,12 @@ export function checkAppUrl() {
453453 showGlobalErrorMessage ( `Your ROOT_URL in app.ini is "${ appUrl } ", it's unlikely matching the site you are visiting.
454454Mismatched ROOT_URL config causes wrong URL links for web UI/mail content/webhook notification/OAuth2 sign-in.` , 'warning' ) ;
455455}
456+
457+ export function checkAppUrlScheme ( ) {
458+ const curUrl = window . location . href ;
459+ // some users visit "http://domain" while appUrl is "https://domain", COOKIE_SECURE makes it impossible to sign in
460+ if ( curUrl . startsWith ( 'http:' ) && appUrl . startsWith ( 'https:' ) ) {
461+ showGlobalErrorMessage ( `Your ROOT_URL in app.ini "${ appUrl } " uses HTTPS, it doesn't match the HTTP site you are visiting.
462+ Mismatched ROOT_URL config would cause problems for sign-in/sign-up, etc.` , 'warning' ) ;
463+ }
464+ }
Original file line number Diff line number Diff line change 1- import { checkAppUrl } from './common-global.js' ;
1+ import { checkAppUrl , checkAppUrlScheme } from './common-global.js' ;
2+
3+ export function initUserCheckAppUrl ( ) {
4+ if ( ! document . querySelector ( '.page-content.user.signin, .page-content.user.signup, .page-content.user.link-account' ) ) return ;
5+ checkAppUrlScheme ( ) ;
6+ }
27
38export function initUserAuthOauth2 ( ) {
49 const outer = document . getElementById ( 'oauth2-login-navigator' ) ;
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import {initFindFileInRepo} from './features/repo-findfile.js';
2323import { initCommentContent , initMarkupContent } from './markup/content.js' ;
2424import { initPdfViewer } from './render/pdf.js' ;
2525
26- import { initUserAuthOauth2 } from './features/user-auth.js' ;
26+ import { initUserAuthOauth2 , initUserCheckAppUrl } from './features/user-auth.js' ;
2727import {
2828 initRepoIssueDue ,
2929 initRepoIssueReferenceRepositorySearch ,
@@ -184,6 +184,7 @@ onDomReady(() => {
184184 initCommitStatuses ( ) ;
185185 initCaptcha ( ) ;
186186
187+ initUserCheckAppUrl ( ) ;
187188 initUserAuthOauth2 ( ) ;
188189 initUserAuthWebAuthn ( ) ;
189190 initUserAuthWebAuthnRegister ( ) ;
You can’t perform that action at this time.
0 commit comments