From b1b26bc23932ffab908030920a768f6fabe7ca8b Mon Sep 17 00:00:00 2001 From: jm1021 Date: Thu, 12 Dec 2024 16:55:29 -0800 Subject: [PATCH] comments on login related files and signup fix --- _includes/nav/home.html | 7 +++++++ _includes/theme/minima/header.html | 3 +++ assets/js/api/login.js | 15 +++++++++++++++ navigation/authentication/login.md | 1 - 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/_includes/nav/home.html b/_includes/nav/home.html index 9ec33306..9ce5c07a 100644 --- a/_includes/nav/home.html +++ b/_includes/nav/home.html @@ -1,9 +1,11 @@ +
@@ -20,6 +22,11 @@ diff --git a/assets/js/api/login.js b/assets/js/api/login.js index aff8b279..4b990bee 100644 --- a/assets/js/api/login.js +++ b/assets/js/api/login.js @@ -2,6 +2,14 @@ import { pythonURI, fetchOptions } from './config.js'; console.log("login.js loaded"); +/** + * This function is called when the DOM is loaded. + * It fetches the credentials from the API and updates the login area, based on the data. + * If the user is authenticated, the name of the user is shown as a link. + * If the user is not authenticated, a "Login" link is shown. + * The authenticated status is stored in the local storage. + * @param {string} baseurl - The base URL of the website. + */ document.addEventListener('DOMContentLoaded', function() { const baseurl = document.querySelector('.trigger').getAttribute('data-baseurl'); console.log("Base URL:", baseurl); // Debugging line @@ -25,6 +33,13 @@ document.addEventListener('DOMContentLoaded', function() { }); }); +/** + * This function fetches the credentials of the User from the API. + * @param {string} baseurl - The base URL of the website. + * @returns {Promise} - The Promise object representing the completion of the function. + * @async - This function performs asynchronous operations using .then() and .catch() for handling responses. + * @function getCredentials + */ function getCredentials(baseurl) { const URL = pythonURI + '/api/id'; return fetch(URL, fetchOptions) diff --git a/navigation/authentication/login.md b/navigation/authentication/login.md index b281797f..79a19501 100644 --- a/navigation/authentication/login.md +++ b/navigation/authentication/login.md @@ -132,7 +132,6 @@ show_reading_time: false name: document.getElementById("name").value, uid: document.getElementById("signupUid").value, password: document.getElementById("signupPassword").value, - kasm_server_needed: document.getElementById("kasmNeeded").checked, } };