Skip to content

Commit 862870c

Browse files
authored
Update account.html
1 parent 8f70d55 commit 862870c

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

account.html

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
color: white;
6363
}
6464
a.kRxZy-link {
65-
color: #4CAF50; /* Green shade that blends well */
65+
color: #4CAF50;
6666
font-weight: bold;
6767
}
6868
a.kRxZy-link:hover {
@@ -72,21 +72,22 @@
7272
<script>
7373
// Generate a random 3-digit number
7474
function generateThreeDigitCode() {
75-
return Math.floor(100 + Math.random() * 900);
76-
}
75+
return Math.floor(100 + Math.random() * 900);
76+
}
77+
78+
let secretCode;
7779
if (!localStorage.getItem('baseCode')) {
78-
const secretCode = generateThreeDigitCode();
79-
localStorage.setItem('baseCode', secretCode);
80+
secretCode = generateThreeDigitCode();
81+
localStorage.setItem('baseCode', secretCode);
8082
} else {
81-
const secretCode = localStorage.getItem('baseCode');
82-
}
83-
83+
secretCode = localStorage.getItem('baseCode');
84+
}
8485

8586
// Generate a key by shifting the baseKey based on the secret code
8687
function generateKeyFromCode(code) {
8788
const baseKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
8889
let shiftedKey = '';
89-
let shift = parseInt(code) % 36;
90+
let shift = parseInt(code) % 36;
9091
for (let i = 0; i < baseKey.length; i++) {
9192
shiftedKey += baseKey[(i + shift) % baseKey.length];
9293
}
@@ -102,22 +103,22 @@
102103
if (index !== -1) {
103104
encoded += key[index];
104105
} else {
105-
encoded += char;
106+
encoded += char;
106107
}
107108
}
108109
return encoded;
109110
}
110111

111112
// On page load, check if the user is logged in
112-
window.onload = function() {
113+
window.onload = function () {
113114
if (localStorage.getItem('loggedIn') === 'true') {
114115
const username = localStorage.getItem('username');
115116
const textElements = document.querySelectorAll('.text');
116117
const loggedIn = document.getElementById('loggedIn');
117118
const tlogged = document.getElementById('textForLogged');
118119

119120
// Hide all elements with the class "text"
120-
textElements.forEach(function(element) {
121+
textElements.forEach(function (element) {
121122
element.style.display = 'none';
122123
});
123124

@@ -135,7 +136,7 @@
135136
const urlParams = new URLSearchParams(window.location.search);
136137
const authSuccess = urlParams.get('success');
137138
const username = urlParams.get('username');
138-
139+
139140
if (username) {
140141
const key = generateKeyFromCode(secretCode);
141142
const encodedUsername = encodeUsername(username.toLowerCase(), key);
@@ -195,28 +196,25 @@ <h2>Welcome! Please log in to continue.</h2>
195196
<button onclick="registerScratchAuth()">Sign In With ScratchAuth</button>
196197
<p id="scratchMessage" class="message" aria-live="polite"></p>
197198
<p>
198-
Please note: You will be redirected to an external site (ScratchAuth) for authentication. Once there,
199+
Please note: You will be redirected to an external site (ScratchAuth) for authentication. Once there,
199200
choose the "Cloud Data" option for the quickest sign-in method.
200-
201-
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.
202201
</p>
203202
</div>
204203

205204
<!-- APIAuth Section -->
206205
<div class="text container">
207206
<h2>Login Using APIAuth</h2>
208-
<button onclick="registerApiAuth()">Login With APIAuth (Made by
207+
<button onclick="registerApiAuth()">Login With APIAuth (Made by
209208
<a href="https://scratch.mit.edu/users/kRxZy_kRxZy/" target="_blank" class="kRxZy-link">kRxZy_kRxZy</a>)</button>
210209
<p id="apiMessage" class="message" aria-live="polite"></p>
211210
<p>
212211
APIAuth, made by <a href="https://scratch.mit.edu/users/kRxZy_kRxZy/" target="_blank" class="kRxZy-link">kRxZy_kRxZy</a>, is the next generation of Scratch Authentication.
213-
You only need to enter your username, put a code in your bio, click Done, and then remove the code. Then, you are logged in.
214212
</p>
215213
</div>
216214

217215
<!-- Report Issue Section -->
218216
<div class="text container">
219-
<a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/issues/new">
217+
<a href="https://github.com/Scratch-Coding-Hut/Scratch-Coding-Hut.github.io/issues/new">
220218
<button>Having trouble signing in? Report an issue</button>
221219
</a>
222220
</div>

0 commit comments

Comments
 (0)