refactor: migrate from bcrypt.js to Nginx basic authentication

This commit is contained in:
Greg 2025-05-27 00:51:03 +02:00
parent 4dd08654c8
commit bdbe781bef
2 changed files with 9 additions and 21 deletions

View File

@ -6,10 +6,7 @@
<title>Keep My Weight - Personal Weight & Meal Tracker</title>
<link rel="stylesheet" href="css/styles.css">
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>⚖️</text></svg>">
<!-- Password hash for authentication (will be replaced by server) -->
<meta name="password-hash" content="$PASSWORD_HASH$">
<!-- bcrypt.js for password verification -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/bcryptjs/2.4.3/bcrypt.min.js"></script>
<!-- Authentication is now handled by Nginx -->
</head>
<body>
<div class="app-container">
@ -207,7 +204,6 @@
<script src="js/dataManager.js"></script>
<script src="js/ui.js"></script>
<script src="js/charts.js"></script>
<script src="js/auth.js"></script>
<script src="js/app.js"></script>
</body>
</html>

View File

@ -3,10 +3,7 @@
* Entry point for the application, initializes all components
*/
document.addEventListener('DOMContentLoaded', () => {
// Initialize authentication first
Auth.init();
// Initialize all other modules
// Initialize all modules
DataManager.init();
UI.init();
Charts.init();
@ -15,22 +12,17 @@ document.addEventListener('DOMContentLoaded', () => {
UI.renderWeightTable();
UI.renderMealTable();
// Add logout button to settings tab
// Add security information to settings tab
const settingsCard = document.querySelector('#settings-content .card:last-child');
if (settingsCard) {
const logoutSection = document.createElement('div');
logoutSection.className = 'form-group';
logoutSection.innerHTML = `
const securitySection = document.createElement('div');
securitySection.className = 'form-group';
securitySection.innerHTML = `
<h3>Security</h3>
<p>Log out of your weight tracker application</p>
<button id="logout-button" class="btn secondary-btn">Logout</button>
<p>Your data is protected by Nginx basic authentication.</p>
<p>To log out, close your browser or clear your browser's authentication cache.</p>
`;
settingsCard.appendChild(logoutSection);
// Add logout functionality
document.getElementById('logout-button').addEventListener('click', () => {
Auth.logout();
});
settingsCard.appendChild(securitySection);
}
console.log('Weight Tracker app initialized successfully');