fix(web): remove password from public applications

This commit is contained in:
nyan404 committed 2026-08-21 14:16:01 +03:00
1 parent 0c59d8cb15
commit e5bd31b428
9 files changed
+9 -91

No files matched your search

+1 -37
View File
@@ -150,16 +150,7 @@
</section>
<section id="applicationsSection" class="hidden" role="tabpanel" aria-labelledby="applicationsTab">
<div id="applicationAuth" class="panel auth-panel">
<h2>Подача заявки</h2>
<p class="muted">Введите пароль, чтобы отправить заявку на рассмотрение и приложить скриншоты.</p>
<form id="applicationAuthForm">
<label>Пароль<input id="applicationPassword" type="password" autocomplete="current-password" required></label>
<p id="applicationAuthError" class="error" role="alert"></p>
<button class="primary" type="submit">Войти</button>
</form>
</div>
<div id="applicationWorkspace" class="hidden">
<div id="applicationWorkspace">
<h2>Новая заявка</h2>
<p class="muted application-intro">Заполните форму — администратор получит структурированную заявку для рассмотрения. Форумную отпись готовить не нужно.</p>
<div class="application-types" role="group" aria-label="Тип заявки">
@@ -366,9 +357,6 @@
const reportsSection = document.querySelector('#reportsSection');
const applicationsSection = document.querySelector('#applicationsSection');
const sectionTabs = [...document.querySelectorAll('[data-section]')];
const applicationAuth = document.querySelector('#applicationAuth');
const applicationWorkspace = document.querySelector('#applicationWorkspace');
const applicationAuthError = document.querySelector('#applicationAuthError');
const applicationForm = document.querySelector('#applicationForm');
const applicationError = document.querySelector('#applicationError');
const applicationSuccess = document.querySelector('#applicationSuccess');
@@ -385,7 +373,6 @@
tab.classList.toggle('active', selected);
tab.setAttribute('aria-selected', String(selected));
});
if (isApplications) checkApplicationSession();
if (updateUrl) {
const url = new URL(window.location.href);
if (isApplications) url.searchParams.set('section', 'applications');
@@ -396,29 +383,6 @@
sectionTabs.forEach(tab => tab.addEventListener('click', () => setSection(tab.dataset.section)));
window.addEventListener('popstate', () => setSection(new URLSearchParams(window.location.search).get('section') === 'applications' ? 'applications' : 'reports', false));
function showApplicationWorkspace() {
applicationAuth.classList.add('hidden');
applicationWorkspace.classList.remove('hidden');
}
async function checkApplicationSession() {
try {
const response = await fetch('/api/web/session');
const data = await response.json();
if (data.authenticated) showApplicationWorkspace();
} catch (_) { /* The login form remains available and explains any error. */ }
}
document.querySelector('#applicationAuthForm').addEventListener('submit', async event => {
event.preventDefault();
applicationAuthError.textContent = '';
const response = await fetch('/api/web/auth', {
method: 'POST', headers: {'Content-Type': 'application/json'},
body: JSON.stringify({password: document.querySelector('#applicationPassword').value}),
});
const data = await response.json();
if (!response.ok) { applicationAuthError.textContent = data.error || 'Не удалось войти'; return; }
showApplicationWorkspace();
});
function addApplicationFeather(values = {}) {
const row = document.createElement('div');
row.className = 'feather';