Skip to content

Commit 9428ec1

Browse files
committed
improved SynackAPI Login button
1 parent 3a6f26e commit 9428ec1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/src/usage/main-components/files.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ It is intended to be used with the following TamperMonkey script in order to do
3434
// @version 0.1
3535
// @description Go to the platform automatically
3636
// @author You
37+
// @run-at document-start
3738
// @match https://*.synack.com/*
3839
// @require file:///home/<homedir>/.config/synack/login.js
3940
// @grant none

src/synack/plugins/auth.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,16 @@ def set_api_token_invalid(self):
8989
return False
9090

9191
def set_login_script(self):
92-
script = "let forceLogin = () => {" +\
92+
script = "(function() {sessionStorage.setItem('shared-session-com.synack.accessToken'" +\
93+
",'" +\
94+
self._state.api_token +\
95+
"');})();" +\
96+
"let forceLogin = () => {" +\
9397
"const loc = window.location;" +\
9498
"if(loc.href.startsWith('https://login." + self._state.synack_domain + "/')) {" +\
9599
"loc.replace('https://platform." + self._state.synack_domain + "');" +\
96100
"}};" +\
97101
"(function() {" +\
98-
"sessionStorage.setItem('shared-session-" +\
99-
'.'.join(reversed(self._state.synack_domain.split('.'))) + ".accessToken'" +\
100-
",'" +\
101-
self._state.api_token +\
102-
"');" +\
103102
"setTimeout(forceLogin,60000);" +\
104103
"let btn = document.createElement('button');" +\
105104
"btn.addEventListener('click',forceLogin);" +\

0 commit comments

Comments
 (0)