diff --git a/account/index.html b/account/index.html
index 66c8a7d..8f68a81 100644
--- a/account/index.html
+++ b/account/index.html
@@ -55,7 +55,7 @@
Deleting your account is an irreversible action. You cannot recover your account once this has been done.
This will delete your account from our database, not from your Wii U or Cemu. You will need to manually remove it from these.
-
+
diff --git a/js/accounts.js b/js/accounts.js
index c02eb0d..79a7241 100644
--- a/js/accounts.js
+++ b/js/accounts.js
@@ -81,7 +81,21 @@ function hideDeleteWarning() {
}
async function deleteAccount() {
- let token = await getToken(username, password);
+ let token;
+
+ let expiryStr = sessionStorage.getItem("authExpires");
+ if (expiryStr) { // Expiry exists so token should exist
+ let expiry = new Date(expiryStr);
+ if (expiry < new Date()) { // Expired token
+ window.location.href = "/account/login?redirect=/account"
+ } else if (!token) { // Expiry Saved but No Token (shouldn't be possible but it'll be caught if it happens)
+ window.location.href = "/account/login?redirect=/account"
+ } else {
+ token = sessionStorage.getItem("authToken");
+ }
+ } else { // Token Never Saved in Session
+ window.location.href = "/account/login?redirect=/account"
+ }
const response = await fetch("https://account.spfn.net/api/v2/users/@me/delete", {
method: "GET",