Skip to content

Commit

Permalink
Added 'SynackAPI Log In' button to login page
Browse files Browse the repository at this point in the history
  • Loading branch information
bamhm182 committed May 22, 2022
1 parent b055224 commit f8d36b9
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/synack/plugins/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,26 @@ def get_notifications_token(self):
return j['token']

def set_login_script(self):
script = "(function() {" +\
"setTimeout(()=>{" +\
script = "let forceLogin = () => {" +\
"const loc = window.location;" +\
"if (loc.href.startsWith('https://login.synack.com/')) {" +\
"if(loc.href.startsWith('https://login.synack.com/')) {" +\
"loc.replace('https://platform.synack.com');" +\
"}" +\
"},15000);" +\
"sessionStorage.setItem(" +\
"'shared-session-com.synack.accessToken','" +\
"}};" +\
"(function() {" +\
"sessionStorage.setItem('shared-session-com.synack.accessToken'" +\
",'" +\
self.db.api_token +\
"');})();"
"');" +\
"setTimeout(forceLogin,60000);" +\
"let btn = document.createElement('button');" +\
"btn.addEventListener('click',forceLogin);" +\
"btn.style = 'margin-top: 20px;';" +\
"btn.innerText = 'SynackAPI Log In';" +\
"btn.classList.add('btn');" +\
"btn.classList.add('btn-blue');" +\
"document.getElementsByClassName('onboarding-form')[0]" +\
".appendChild(btn)}" +\
")();"
with open(self.state.config_dir / 'login.js', 'w') as fp:
fp.write(script)

Expand Down

0 comments on commit f8d36b9

Please sign in to comment.