Skip to content

Commit 84c5ef0

Browse files
authored
Update account.html
1 parent 1446f5c commit 84c5ef0

File tree

1 file changed

+14
-26
lines changed

1 file changed

+14
-26
lines changed

src/account.html

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,18 @@
8989
</style>
9090

9191
<script>
92-
function decodeUsername(encodedUsername) {
93-
return atob(encodedUsername);
94-
}
95-
9692
function encodeUsername(username) {
9793
return btoa(username);
9894
}
9995

96+
function decodeUsername(encodedUsername) {
97+
return atob(encodedUsername);
98+
}
99+
100100
window.onload = async function () {
101101
try {
102102
if (localStorage.getItem('loggedIn') === 'true') {
103-
const usernameEncoded = localStorage.getItem('usernameEnc');
104-
const username = decodeUsername(usernameEncoded);
105-
localStorage.setItem('username', username);
103+
const username = localStorage.getItem('username');
106104

107105
document.getElementById('authSection').style.display = 'none';
108106
document.getElementById('loggedInContent').style.display = 'block';
@@ -132,18 +130,19 @@
132130
try {
133131
const res = await fetch(`https://auth-api.itinerary.eu.org/auth/verifyToken/${PC}`);
134132
const data = await res.json();
135-
const username = btoa(data.username);
133+
const plainUsername = data.username;
134+
const encodedUsername = btoa(plainUsername);
136135

137136
// Ban check (example logic)
138-
if (username === 'PUT THE FIRST BANNED USER HERE') {
137+
if (encodedUsername === 'PUT THE FIRST BANNED USER HERE') {
139138
localStorage.removeItem('loggedIn');
140139
localStorage.removeItem('username');
141140
window.location.href = 'banscreen.html?reason=spam';
142141
return;
143142
}
144143

145-
localStorage.setItem('usernameEnc', data.username); // base64
146-
localStorage.setItem('username', username); // plain text
144+
localStorage.setItem('usernameEnc', encodedUsername); // encoded version
145+
localStorage.setItem('username', plainUsername); // plain version
147146
localStorage.setItem('loggedIn', 'true');
148147
window.location.href = 'index.html';
149148
} catch (err) {
@@ -164,18 +163,6 @@
164163
}, 2000);
165164
}
166165

167-
function registerApiAuth() {
168-
const messageBox = document.getElementById("apiMessage");
169-
const redirectLocation = encodeURIComponent(window.location.href);
170-
const authUrl = `https://ubbload.netlify.app/login?redirect=${redirectLocation}`;
171-
172-
messageBox.style.color = "green";
173-
messageBox.textContent = "Redirecting to APIAuth login (ubbload)... Follow the steps there.";
174-
setTimeout(() => {
175-
window.location.href = authUrl;
176-
}, 2000);
177-
}
178-
179166
function logout() {
180167
localStorage.removeItem('loggedIn');
181168
localStorage.removeItem('username');
@@ -191,11 +178,12 @@
191178
}
192179

193180
function devToken() {
194-
const usernameEnc = localStorage.getItem('usernameEnc');
181+
const username = localStorage.getItem('username');
195182
const devTokens = document.getElementById('devTokens');
196183

197-
if (usernameEnc && devTokens) {
198-
const joined = "Your dev token is: " + usernameEnc + " - Make sure to only share it with Coding Hut services and partners or else you can get hacked!";
184+
if (username && devTokens) {
185+
const token = btoa(username);
186+
const joined = "Your dev token is: " + token + " - Make sure to only share it with Coding Hut services and partners or else you can get hacked!";
199187
devTokens.style.color = "green";
200188
devTokens.textContent = joined;
201189
}

0 commit comments

Comments
 (0)