Update script.js
Browse files
script.js
CHANGED
|
@@ -24,8 +24,9 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
| 24 |
// Token is valid, extract user's email and display it
|
| 25 |
const userObject = jwt_decode(token); // Decode the token to get user info
|
| 26 |
const email = userObject.email; // Assuming the email is stored in the token
|
|
|
|
| 27 |
// Display user information
|
| 28 |
-
document.getElementById('user-name').innerText =
|
| 29 |
userInfoDiv.style.display = 'block'; // Show user info
|
| 30 |
document.getElementById('logout-button').style.display = 'inline'; // Show logout button
|
| 31 |
loginLink.style.display = 'none'; // Hide login link
|
|
|
|
| 24 |
// Token is valid, extract user's email and display it
|
| 25 |
const userObject = jwt_decode(token); // Decode the token to get user info
|
| 26 |
const email = userObject.email; // Assuming the email is stored in the token
|
| 27 |
+
const username = email.split('@')[0];
|
| 28 |
// Display user information
|
| 29 |
+
document.getElementById('user-name').innerText = username; // Display first name
|
| 30 |
userInfoDiv.style.display = 'block'; // Show user info
|
| 31 |
document.getElementById('logout-button').style.display = 'inline'; // Show logout button
|
| 32 |
loginLink.style.display = 'none'; // Hide login link
|