Loading editor/html/login.html +8 −2 Original line number Diff line number Diff line Loading @@ -170,6 +170,12 @@ var errBox = document.getElementById('login-error'); var btn = document.getElementById('login-btn'); // Derive the mount prefix from the current location so login works both // at the domain root and behind a proxy prefix (e.g. /editor). Strips a // trailing slash and an optional /login or /login.html suffix. var basePath = window.location.pathname .replace(/\/(login|login\.html|index\.html)?$/, ''); form.addEventListener('submit', function(e) { e.preventDefault(); errBox.style.display = 'none'; Loading @@ -177,7 +183,7 @@ btn.textContent = I18n.t('Loading...', 'Signing in...'); var xhr = new XMLHttpRequest(); xhr.open('POST', '/api/login', true); xhr.open('POST', basePath + '/api/login', true); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onreadystatechange = function() { if (xhr.readyState !== 4) return; Loading @@ -185,7 +191,7 @@ btn.textContent = I18n.t('Submit', 'Sign in'); if (xhr.status === 200) { window.location.href = '/'; window.location.href = basePath + '/'; } else { try { var resp = JSON.parse(xhr.responseText); Loading Loading
editor/html/login.html +8 −2 Original line number Diff line number Diff line Loading @@ -170,6 +170,12 @@ var errBox = document.getElementById('login-error'); var btn = document.getElementById('login-btn'); // Derive the mount prefix from the current location so login works both // at the domain root and behind a proxy prefix (e.g. /editor). Strips a // trailing slash and an optional /login or /login.html suffix. var basePath = window.location.pathname .replace(/\/(login|login\.html|index\.html)?$/, ''); form.addEventListener('submit', function(e) { e.preventDefault(); errBox.style.display = 'none'; Loading @@ -177,7 +183,7 @@ btn.textContent = I18n.t('Loading...', 'Signing in...'); var xhr = new XMLHttpRequest(); xhr.open('POST', '/api/login', true); xhr.open('POST', basePath + '/api/login', true); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onreadystatechange = function() { if (xhr.readyState !== 4) return; Loading @@ -185,7 +191,7 @@ btn.textContent = I18n.t('Submit', 'Sign in'); if (xhr.status === 200) { window.location.href = '/'; window.location.href = basePath + '/'; } else { try { var resp = JSON.parse(xhr.responseText); Loading