Skip to content

Commit 3c5e000

Browse files
authored
Update account.html
1 parent 7e733f0 commit 3c5e000

File tree

1 file changed

+43
-15
lines changed

1 file changed

+43
-15
lines changed

account.html

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,18 @@
6161
text-decoration: none;
6262
color: white;
6363
}
64+
a.kRxZy-link {
65+
color: #4CAF50; /* Green shade that blends well */
66+
font-weight: bold;
67+
}
68+
a.kRxZy-link:hover {
69+
color: #388E3C;
70+
}
6471
</style>
6572
<script>
6673
const secretCode = '972';
6774

75+
// Generate a key by shifting the baseKey based on the secret code
6876
function generateKeyFromCode(code) {
6977
const baseKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
7078
let shiftedKey = '';
@@ -75,6 +83,7 @@
7583
return shiftedKey;
7684
}
7785

86+
// Encode the username using the generated key
7887
function encodeUsername(username, key) {
7988
const baseKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
8089
let encoded = '';
@@ -89,20 +98,27 @@
8998
return encoded;
9099
}
91100

101+
// On page load, check if the user is logged in
92102
window.onload = function() {
93103
if (localStorage.getItem('loggedIn') === 'true') {
94104
const username = localStorage.getItem('username');
95-
const text = document.getElementById('text');
105+
const textElements = document.querySelectorAll('.text');
96106
const loggedIn = document.getElementById('loggedIn');
97-
98-
text.style.display = 'none';
107+
108+
// Hide all elements with the class "text"
109+
textElements.forEach(function(element) {
110+
element.style.display = 'none';
111+
});
112+
113+
// Show the welcome message
99114
loggedIn.style.display = 'block';
100-
loggedIn.textContent = `Welcome to your account ${username}!`;
115+
loggedIn.textContent = `Welcome to your account, ${username}!`;
101116
} else {
102117
checkAuth();
103118
}
104119
};
105120

121+
// Check for authentication on page load
106122
function checkAuth() {
107123
const urlParams = new URLSearchParams(window.location.search);
108124
const authSuccess = urlParams.get('success');
@@ -123,6 +139,7 @@
123139
}
124140
}
125141

142+
// Redirect to ScratchAuth for authentication
126143
function registerScratchAuth() {
127144
const messageBox = document.getElementById("message");
128145
const redirectLocation = encodeURIComponent(window.location.href);
@@ -137,6 +154,7 @@
137154
}, 2000);
138155
}
139156

157+
// Redirect to APIAuth for authentication
140158
function registerApiAuth() {
141159
const messageBox = document.getElementById("message");
142160
const redirectLocation = encodeURIComponent(window.location.href);
@@ -153,27 +171,37 @@
153171
</script>
154172
</head>
155173
<body>
156-
<div id="text" class="header">
174+
<!-- Header Content -->
175+
<div class="text header">
157176
<h1>Scratch Authentication</h1>
158177
</div>
159-
<div id="loggedIn" class="header"></div>
178+
<div id="loggedIn" class="header" style="display: none;"></div>
160179

161-
<div id="text" class="content">
180+
<!-- Main Content -->
181+
<div class="text content">
162182
<h2>Welcome! Please log in to continue.</h2>
163183
<button onclick="registerScratchAuth()">Register With ScratchAuth</button>
164-
<p id="message" id="text" class="message" aria-live="polite"></p>
165-
<p id="text">
184+
<p id="message" class="message" aria-live="polite"></p>
185+
<p>
166186
Please note: You will be redirected to an external site (ScratchAuth) for authentication. Once there,
167187
choose the "Cloud Data" option for the quickest sign-in method.
168-
169-
If you are unable to use the "Cloud Data" option, other sign-in methods are available on Scratch Auth's page, for example, profile commenting.</p>
188+
189+
If you are unable to use the "Cloud Data" option, other sign-in methods are available on Scratch Auth's page, for example, profile commenting.
190+
</p>
170191
</div>
171192

172-
<div id="text" class="container">
193+
<!-- APIAuth Section -->
194+
<div class="text container">
173195
<h2>Login Using APIAuth</h2>
174-
<button onclick="registerApiAuth()">Login With APIAuth (Made by <a href="https://scratch.mit.edu/users/kRxZy_kRxZy/" target="_blank" style="color: blue">kRxZy_kRxZy</a>)</button>
196+
<button onclick="registerApiAuth()">Login With APIAuth (Made by
197+
<a href="https://scratch.mit.edu/users/kRxZy_kRxZy/" target="_blank" class="kRxZy-link">kRxZy_kRxZy</a>)</button>
198+
</div>
199+
200+
<!-- Report Issue Section -->
201+
<div class="text container">
202+
<a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/issues/new">
203+
<button>Having trouble signing in? Report an issue</button>
204+
</a>
175205
</div>
176-
<div id="text" class="container"><a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/issues/new">
177-
<button>Having trouble signing in? Report an issue</button></a><div>
178206
</body>
179207
</html>

0 commit comments

Comments
 (0)