Convert more authentication apis to controllers and session management

- Updated `AuthController.cs` to change unauthenticated response to `Unauthorized` and added a new `Logout` method for session handling.
- Removed the old logout endpoint in `Program.cs` and centralized logout logic in `AuthController.cs`.
- Added `GetSession` and `DeleteSession` methods in `DatabaseService.cs` to enhance session management.
- Updated API endpoints in `dash.js` to reflect new routing structure for authorized account info and logout.
This commit is contained in:
whoswhip
2025-07-06 18:59:39 -04:00
parent 73248e723a
commit 89e9673a00
4 changed files with 93 additions and 51 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ document.addEventListener('DOMContentLoaded', function () {
async function fetchAccountInfo() {
try {
const response = await fetch('/api/accounts/authorized');
const response = await fetch('/api/auth/authorized');
const accountData = await response.json();
if (accountData.success === false) {
@@ -212,7 +212,7 @@ function logout() {
document.getElementById('confirm-logout').onclick = async function () {
try {
await fetch('/api/accounts/logout', { method: 'POST'});
await fetch('/api/auth/logout', { method: 'POST'});
} catch { }
window.location.href = '/login';
};