Skip to content

Commit

Permalink
Added reset page
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Scholer committed Nov 10, 2021
1 parent 1a68503 commit c8d40f8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
22 changes: 12 additions & 10 deletions content.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,25 @@ window.password_prompt = function (label_message, button_message, arg3, arg4, ar
//Click on the "Purdue West Lafayette" button
window.addEventListener("load", redirectCAS, false);

let url = new URL(window.location.href);
let reset = url.searchParams.get("reset") === "true";

//Make sure we're on Purdue's CAS, otherwise, don't do anything.
if (window.location.href.startsWith("https://www.purdue.edu/apps/account/cas/login") === true) {
let url = new URL(window.location.href);
let reset = url.searchParams.get("reset");
if (reset === "true") {
alert("Reset time!");
localStorage.removeItem("pin");
localStorage.removeItem("code");
localStorage.removeItem("hotpSecret");
localStorage.removeItem("username");
localStorage.removeItem("counter");
if (reset) {
if (confirm("Are you sure you want to reset BoilerKey Helper?")) {
localStorage.removeItem("pin");
localStorage.removeItem("code");
localStorage.removeItem("hotpSecret");
localStorage.removeItem("username");
localStorage.removeItem("counter");
}
window.close();
}
}

//Make sure we're on Purdue's CAS, otherwise, don't do anything.
if (window.location.href.startsWith("https://www.purdue.edu/apps/account/cas/login") === true) {
if (window.location.href.startsWith("https://www.purdue.edu/apps/account/cas/login") && !reset) {
//Retrieve everything from localStorage.
let pin, code, hotpSecret, username;
pin = get("pin");
Expand Down
5 changes: 3 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "BoilerKey Helper",
"description": "An extension that alleviates Purdue's BoilerKey two-factor authentication.",
"author": "The Purdue Community",
"version": "1.8.1",
"version": "1.9.0",
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
Expand All @@ -27,7 +27,8 @@
},
"browser_action": {
"default_icon": "icons/icon128.png",
"default_title": "BoilerKey Helper"
"default_title": "BoilerKey Helper",
"default_popup": "popup.html"
},
"permissions": [
"https://api-1b9bef70.duosecurity.com/"
Expand Down

0 comments on commit c8d40f8

Please sign in to comment.