Skip to content

Commit 7e733f0

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

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

account.html

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,32 @@
6363
}
6464
</style>
6565
<script>
66+
const secretCode = '972';
67+
68+
function generateKeyFromCode(code) {
69+
const baseKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
70+
let shiftedKey = '';
71+
let shift = parseInt(code) % 36;
72+
for (let i = 0; i < baseKey.length; i++) {
73+
shiftedKey += baseKey[(i + shift) % baseKey.length];
74+
}
75+
return shiftedKey;
76+
}
77+
78+
function encodeUsername(username, key) {
79+
const baseKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
80+
let encoded = '';
81+
for (let char of username) {
82+
let index = baseKey.indexOf(char);
83+
if (index !== -1) {
84+
encoded += key[index];
85+
} else {
86+
encoded += char;
87+
}
88+
}
89+
return encoded;
90+
}
91+
6692
window.onload = function() {
6793
if (localStorage.getItem('loggedIn') === 'true') {
6894
const username = localStorage.getItem('username');
@@ -83,7 +109,10 @@
83109
const username = urlParams.get('username');
84110

85111
if (username) {
86-
localStorage.setItem('username', username);
112+
const key = generateKeyFromCode(secretCode);
113+
const encodedUsername = encodeUsername(username.toLowerCase(), key);
114+
115+
localStorage.setItem('username', encodedUsername);
87116
localStorage.setItem('loggedIn', 'true');
88117
window.location.href = 'index.html';
89118
}

0 commit comments

Comments
 (0)