forked from supriya46788/Research-Paper-Organizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile.html
More file actions
52 lines (52 loc) · 1.93 KB
/
profile.html
File metadata and controls
52 lines (52 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Profile & Settings</title>
<link rel="stylesheet" href="css/style.css">
<script src="https://kit.fontawesome.com/yourkit.js" crossorigin="anonymous"></script>
</head>
<body>
<div class="profile-container">
<h2>User Profile</h2>
<div class="profile-info">
<p><strong>Name:</strong> <span id="profileName"></span></p>
<p><strong>Email:</strong> <span id="profileEmail"></span></p>
<p><strong>Account Created:</strong> <span id="profileCreated"></span></p>
</div>
<hr>
<h3>Settings</h3>
<div class="settings-section">
<label for="themeSelect">Theme:</label>
<select id="themeSelect">
<option value="light">Light</option>
<option value="dark">Dark</option>
</select>
</div>
<button onclick="logout()" class="logout-btn">Logout</button>
</div>
<script>
document.addEventListener("DOMContentLoaded", function() {
const user = JSON.parse(localStorage.getItem('current_user'));
if (!user) {
window.location.href = 'login.html';
return;
}
document.getElementById('profileName').textContent = user.name;
document.getElementById('profileEmail').textContent = user.email;
document.getElementById('profileCreated').textContent = user.createdAt ? new Date(user.createdAt).toLocaleDateString() : 'N/A';
const themeSelect = document.getElementById('themeSelect');
themeSelect.value = localStorage.getItem('theme') || 'light';
themeSelect.addEventListener('change', function() {
localStorage.setItem('theme', this.value);
document.body.className = this.value === 'dark' ? 'dark-mode' : '';
});
});
function logout() {
localStorage.removeItem('current_user');
window.location.href = 'login.html';
}
</script>
</body>
</html>