mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
Enhance user authentication and paste management
- Updated `AuthController.cs` to include token in `CreateSession` and improved validation for username and email. - Refactored paste creation logic from `Program.cs` to a new `PasteController.cs`. - Added email validation method in `HelperService.cs`. - Introduced `CompressionService.cs` for handling string compression and decompression. - Improved user experience with autocomplete and spellcheck in HTML forms. - Enhanced date display in `archive.js` and refactored date formatting in `dash.js`. - Updated API endpoints in `login.js` and `register.js` to reflect changes.
This commit is contained in:
@@ -171,6 +171,8 @@ const navbarHTML = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
let authData = null;
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
document.body.insertAdjacentHTML('afterbegin', navbarHTML);
|
||||
var path = window.location.pathname;
|
||||
@@ -178,8 +180,9 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
|
||||
let accountHref = '/login';
|
||||
try {
|
||||
const resp = await fetch('/api/accounts/authorized');
|
||||
const resp = await fetch('/api/auth/authenticated');
|
||||
const data = await resp.json();
|
||||
authData = data;
|
||||
if (data && data.success !== false) {
|
||||
accountHref = '/dash';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user