Changeset 6
- Timestamp:
- 06/06/2007 12:07:54 PM (2 years ago)
- Files:
-
- trunk/client-side/Firefox-extension/chrome/content/code/console.js (modified) (4 diffs)
- trunk/client-side/Firefox-extension/chrome/content/code/gatekeeper.js (modified) (12 diffs)
- trunk/client-side/Firefox-extension/chrome/content/code/observers.js (modified) (4 diffs)
- trunk/client-side/Firefox-extension/chrome/content/code/utils.js (modified) (2 diffs)
- trunk/client-side/Firefox-extension/chrome/content/detailView.html (modified) (4 diffs)
- trunk/client-side/Firefox-extension/chrome/content/gatekeeperOverlay.xul (modified) (3 diffs)
- trunk/client-side/Firefox-extension/chrome/skin/toolbar.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/client-side/Firefox-extension/chrome/content/code/console.js
r3 r6 1 var consoleDetails = "";2 1 3 2 function cprint(msg,detail,type) … … 6 5 detail=true; 7 6 if (!detail) 7 { 8 if (type=="error") 9 prefix = "*error*" 10 else 11 if (type=="success") 12 prefix = "*success*" 13 else 14 prefix = "" 15 setValue("consoleText",getValue("consoleText")+"œ"+prefix+msg); 16 dump(msg,type) 17 } 18 else 19 cprintDet(msg,type); 20 } 21 22 function cprintDet(msg,type) 23 { 24 msg = msg.replace(/\n/gi,"<br />"); 25 prefix = "<span>"; 26 sufix = "</span><br />" 27 if (type=="error") 28 prefix = "<span class='console-error'>"; 29 else if (type=="success") 30 prefix = "<span class='console-success'>"; 31 setValue("consoleDetails",getValue("consoleDetails")+prefix+msg+sufix); 32 dumpDetails(); 33 } 34 35 function dump(msg,type) 36 { 37 if (msg && type) 8 38 { 9 39 console = document.getElementById("kerpass-console"); … … 21 51 } 22 52 else 23 cprintDet(msg,type); 24 } 53 { 54 locator=document.getElementById("kerpass-console"); 55 junk=locator.getElementsByTagName("listitem"); 56 if (junk.length!=0) 57 do 58 locator.removeChild(junk[0]); 59 while (junk.length!=0) 60 61 tmp = getValue("consoleText") 62 cItems = tmp.split("œ") 63 for (item in cItems) 64 { 65 if (cItems[item]!="") 66 { 67 type="" 68 if (cItems[item].substr(0,7)=="*error*") 69 { 70 type="error"; 71 msg = cItems[item].substr(7) 72 } 73 else 74 if (cItems[item].substr(0,9)=="*success*") 75 { 76 type="success" 77 msg = cItems[item].substr(9) 78 } 79 else 80 msg = cItems[item] 25 81 26 function cprintDet(msg,type) 27 { 28 msg = msg.replace(/\n/gi,"<br />"); 29 prefix = "<span>"; 30 sufix = "</span><br />" 31 if (type=="error") 32 prefix = "<span class='console-error'>"; 33 else if (type=="success") 34 prefix = "<span class='console-success'>"; 35 consoleDetails += prefix+msg+sufix; 36 dumpDetails(); 82 console = document.getElementById("kerpass-console"); 83 entry = document.createElement("listitem"); 84 text = document.createElement("listcell"); 85 86 text.setAttribute("label",msg); 87 entry.appendChild(text); 88 console.appendChild(entry); 89 90 if (type=="error") 91 entry.setAttribute("class","errorConsoleItem") 92 else if (type=="success") 93 entry.setAttribute("class","successConsoleItem") 94 console.ensureElementIsVisible(entry) 95 } 96 } 97 } 37 98 } 38 99 39 100 function dumpDetails() 40 101 { 41 elm = window.content.document.getElementById("detailed-console"); 42 if (elm) 43 { 44 elm.innerHTML = consoleDetails; 45 elm.scrollTop = elm.scrollHeight; 46 } 102 container = document.getElementById("consoleWindow") 103 104 try 105 { 106 elm = container.contentDocument.getElementById("detailed-console"); 107 elm.innerHTML = getValue("consoleDetails"); 108 elm.scrollTop = elm.scrollHeight; 109 } 110 catch(error) 111 { 112 } 47 113 } 48 114 … … 55 121 locator.removeChild(junk[0]); 56 122 while (junk.length!=0) 57 consoleDetails = ""; 123 setValue("consoleDetails",""); 124 setValue("consoleText","") 58 125 dumpDetails() 59 126 } 60 127 61 function detailedMode()128 function openDetailedConsole() 62 129 { 63 detailsTab = getBrowser().addTab("chrome://kerpass/content/detailView.html"); 64 detailsTab.setAttribute("state","gkDetailsTab"); 65 detailsTab.setAttribute("mode","kerpass"); 66 getBrowser().selectedTab = detailsTab; 67 detailsTab.focus(); 68 dumpDetails(); 130 console = document.getElementById("consoleHolder"); 131 console.setAttribute("hidden","false"); 132 133 spliter = document.getElementById("advConsole-splitter"); 134 consoleWindow = document.getElementById("consoleWindow"); 135 spliter.setAttribute("hidden","false"); 136 setValue("consoleOpened","true"); 137 138 setTimeout('dumpDetails()',100) 69 139 } 70 140 141 function closeDetaileConsole(terminate) 142 { 143 spliter = document.getElementById("advConsole-splitter"); 144 console = document.getElementById("consoleHolder"); 145 146 spliter.setAttribute("hidden","true"); 147 console.setAttribute("hidden","true"); 148 if (terminate) 149 setValue("consoleOpened","false"); 150 151 } 152 trunk/client-side/Firefox-extension/chrome/content/code/gatekeeper.js
r3 r6 13 13 14 14 // loginBox = document.getElementById("kerLogin"); 15 kerOtp = document.getElementById("kerOtp"); 16 kerPassword = document.getElementById("kerPassword"); 17 bar = document.getElementById("kerpass-toolbar"); 15 18 16 19 var explicitRegexp = /(.*)@(?:(.*?)\.|)(.*)\.(.+)/; … … 25 28 // result += "Site ext: "+matchExplicit[4]+"\n" 26 29 // alert(result) 27 kerOtp = document.getElementById("kerOtp");28 kerPassword = document.getElementById("kerPassword");29 bar = document.getElementById("kerpass-toolbar");30 30 switch (matchExplicit[2]) 31 31 { … … 53 53 if (matchImplicit != null && matchImplicit.length >1) 54 54 { 55 kerOtp = document.getElementById("kerOtp");56 kerPassword = document.getElementById("kerPassword");57 bar = document.getElementById("kerpass-toolbar");58 55 switch (matchImplicit[2]) 59 56 { … … 86 83 bar.setAttribute("style","height:100px;") 87 84 } 88 check4Enter(event) 89 } 90 91 function check4Enter(event) 92 { 93 if (event.keyCode== 13) 94 step1() 95 } 85 } 86 96 87 97 88 function makeBar(style) … … 112 103 break; 113 104 } 105 setValue("barMode",style) 114 106 } 115 107 … … 162 154 } 163 155 156 function setValue(key,value) 157 { 158 tab = getBrowser().selectedTab; 159 tab.setAttribute(key,value); 160 } 161 162 function getValue(key) 163 { 164 tab = getBrowser().selectedTab; 165 return tab.getAttribute(key); 166 } 164 167 165 168 … … 258 261 259 262 authURL = ""; 260 if ( pathToAuth.substr(0,1)!="/")261 authURL = starterURL+ pathToAuth;263 if (getValue("pathToAuth").substr(0,1)!="/") 264 authURL = starterURL+getValue("pathToAuth"); 262 265 else 263 266 { 264 267 baseUrlRegexp = /((?:https|http):\/\/(?:.*?)\/)/; 265 268 baseUrl = baseUrlRegexp.exec(starterURL)[1]; 266 authURL = baseUrl+ pathToAuth.substr(1);269 authURL = baseUrl+getValue("pathToAuth").substr(1); 267 270 } 268 271 … … 292 295 293 296 } 294 var pathToAuth; 295 var gk_is_open; 297 296 298 var K_uas; 297 299 var r_chal; … … 300 302 { 301 303 cprint("Recived from server at step3: <br />"+data); 304 if (data=="Protocol error!") 305 { 306 cprint("Error authenticating user",false,"error"); 307 hideLoader(); 308 makeBar("bad"); 309 } 302 310 M2_s = data.split("::")[0]; 303 311 atoken_S = data.split("::")[1]; … … 315 323 makeBar("bad"); 316 324 } 317 318 325 319 326 K_uas = calcSHA1("3"+K).substr(0,16); … … 397 404 function popGatekeeper(path) 398 405 { 399 // handlePreferences() 400 makeBar("neutral"); 401 cprint("Welcome to Gatekeeper",false,"success"); 402 cprint("ATTENTION!!!",false,"error") 403 cprint("DO NOT enter your passwords elswere than gatekeeper.",false) 404 cprint("By this, you ensure that your password wown't be stolen.",false); 405 var tab = getBrowser().selectedTab; 406 tab.setAttribute("mode","kerpass"); 406 if (getValue("transInProg")=="true") 407 showLoader() 408 else 409 hideLoader() 410 dump() 411 makeBar(getValue("barMode")); 412 if (getValue("firstTime")!="true") 413 { 414 cprint("Welcome to Gatekeeper",false,"success"); 415 cprint("ATTENTION!!!",false,"error"); 416 cprint("DO NOT enter your passwords elswere than gatekeeper.",false); 417 cprint("By this, you ensure that your password wown't be stolen.",false); 418 setValue("firstTime","true"); 419 setValue("kerUid","login"); 420 setValue("kerPassword","mm"); 421 setValue("kerOtp",""); 422 423 } 424 setValue("mode","kerpass"); 407 425 el = document.getElementById("kerpass-toolbar"); 408 426 el.setAttribute("hidden","false"); 409 gk_is_open = true; 410 pathToAuth = path; 411 } 412 413 function closeToolbar() 427 428 if (path) 429 setValue("pathToAuth",path); 430 if (getValue("consoleOpened")=="true") 431 openDetailedConsole() 432 } 433 434 function closeToolbar(terminate) 414 435 { 415 436 var tab = getBrowser().selectedTab; … … 417 438 el = document.getElementById("kerpass-toolbar"); 418 439 el.setAttribute("hidden","true"); 419 tHeight = 10; 420 pathToAuth = null; 421 gk_is_open = false; 440 closeDetaileConsole(terminate) 422 441 // removeFromListener(oHeaderInfoLive); 423 442 } trunk/client-side/Firefox-extension/chrome/content/code/observers.js
r3 r6 77 77 { 78 78 } 79 if (headerProbe && !gk_is_open)79 if (headerProbe && getValue("mode")!="kerpass") 80 80 { 81 81 popGatekeeper(headerProbe); … … 121 121 tab = getBrowser().selectedTab; 122 122 el = document.getElementById("kerpass-toolbar"); 123 hidden = el.getAttribute("hidden")124 123 mode = tab.getAttribute("mode") 125 124 state = tab.getAttribute("state") 126 125 tHeight = 91; 127 if ((mode=="kerpass")&&(hidden=="true")) 128 popGatekeeper() 129 if ((mode!="kerpass")&&(hidden=="false")) 126 if ((mode=="kerpass")) 127 { 128 kerUid = document.getElementById("kerUid"); 129 kerUid.value = getValue("kerUid"); 130 131 kerPassword = document.getElementById("kerPassword"); 132 kerPassword.value = getValue("kerPassword"); 133 134 kerOtp = document.getElementById("kerOtp"); 135 kerOtp.value = getValue("kerOtp"); 136 137 popGatekeeper() 138 } 139 if ((mode!="kerpass")) 130 140 closeToolbar() 131 if (state=="gkDetailsTab") 132 { 133 dumpDetails(); 134 } 141 dumpDetails(); 142 143 135 144 } 136 145 … … 148 157 status = status.QueryInterface(Components.interfaces.nsISSLStatus); 149 158 var cert = status.serverCert; 150 alert(cert.sha1Fingerprint); 159 setValue("cert",cert.sha1Fingerprint) 160 alert(getValue("cert")); 151 161 } 152 162 catch(error) 153 163 { 154 // alert("ERROR: "+error.description)155 // setTimeout("getCertificate()",1000)156 164 } 157 165 } … … 162 170 if (el.value=="Login " || el.value=="Password "|| el.value=="OTP ") 163 171 el.value="" 172 } 173 174 function keyPressed(event,obj) 175 { 176 if (event.keyCode== 13) 177 step1() 178 setValue(obj.id,obj.value) 164 179 } 165 180 trunk/client-side/Firefox-extension/chrome/content/code/utils.js
r3 r6 50 50 el = document.getElementById("throber"); 51 51 el.setAttribute("style","display:block"); 52 setValue("transInProg","true") 52 53 } 53 54 … … 56 57 el = document.getElementById("throber"); 57 58 el.setAttribute("style","display:none"); 58 59 setValue("transInProg","false") 59 60 } 60 61 trunk/client-side/Firefox-extension/chrome/content/detailView.html
r3 r6 10 10 </head> 11 11 <style type="text/css"> 12 * 13 { 14 padding:0px; 15 margin:0px; 16 } 12 17 body 13 18 { … … 24 29 background-color:white; 25 30 border:1px solid black; 26 } 27 28 input 29 { 30 margin-top:10px; 31 margin:10px; 31 32 } 32 33 … … 46 47 { 47 48 color:white; 48 text-align:center; 49 margin-top:2px; 50 margin-left:4px; 49 51 } 50 52 </style> … … 53 55 <div id="detailed-console"> 54 56 </div> 55 <form action="#">56 <input type="button" value="Close" onclick="window.close();">57 </form>58 57 </body> 59 58 </html> trunk/client-side/Firefox-extension/chrome/content/gatekeeperOverlay.xul
r3 r6 8 8 9 9 10 <script type="application/x-javascript" src="chrome://kerpass/content/code/ srp/hmac.js" />11 <script type="application/x-javascript" src="chrome://kerpass/content/code/ srp/bigint.js" />12 <script type="application/x-javascript" src="chrome://kerpass/content/code/ srp/aes.js" />13 <script type="application/x-javascript" src="chrome://kerpass/content/code/ srp/sha1.js" />10 <script type="application/x-javascript" src="chrome://kerpass/content/code/crypto/hmac.js" /> 11 <script type="application/x-javascript" src="chrome://kerpass/content/code/crypto/bigint.js" /> 12 <script type="application/x-javascript" src="chrome://kerpass/content/code/crypto/aes.js" /> 13 <script type="application/x-javascript" src="chrome://kerpass/content/code/crypto/sha1.js" /> 14 14 15 15 <script type="application/x-javascript" src="chrome://kerpass/content/code/console.js" /> … … 21 21 <toolbox id="navigator-toolbox"> 22 22 <toolbar insertafter="toolbar-menubar" id="kerpass-toolbar" customizable="true" class="chromeclass-toolbar" hidden="true" fullscreentoolbar="true"> 23 <hbox> 24 <vbox> 25 <image class="tabs-closebutton" onclick="closeToolbar()" /> 26 </vbox> 27 <vbox> 28 <image id="user" /> 29 </vbox> 30 <vbox id='throber'> 31 <image id="loading" /> 32 </vbox> 33 <vbox id="inputContainers"> 34 <!--value="9HA3NHTYB7EK"--> 35 <textbox value="login" type="text" onkeyup="parseIdInput(this,event)" id="kerUid" onfocus="focusInput(this)"/> 36 <textbox id="kerPassword" type="password" value="mm" onfocus="focusInput(this)" onkeyup="check4Enter(event)"/> 37 <textbox id="kerOtp" class='otp' type="text" value="OTP " onfocus="focusInput(this)" onkeyup="check4Enter(event)" hidden="true"/> 38 <button id="loginBtn" label="Login" oncommand="step1()"/> 39 </vbox> 40 <vbox id="console-holder"> 41 <tabpanel id="console-holder"> 23 <hbox flex="1"> 24 <vbox> 25 <image class="tabs-closebutton" onclick="closeToolbar()" /> 26 </vbox> 42 27 43 <listbox flex="1" id="kerpass-console" rows="3" suppressonselect="false" context="console-menu"> 44 <listcols> 45 <listcol flex="1"/> 46 </listcols> 47 </listbox> 48 49 <popup id="console-menu"> 50 <menuitem label="Clear" oncommand="clearConsole()"/> 51 <menuitem label="Detailed mode" oncommand="detailedMode()"/> 52 </popup> 53 54 </tabpanel> 55 </vbox> 28 <vbox> 29 <image id="user" /> 30 </vbox> 31 32 <vbox id='throber'> 33 <image id="loading" /> 34 </vbox> 35 36 <vbox id="inputContainers"> 37 <!--value="9HA3NHTYB7EK"--> 38 <textbox value="login" type="text" onkeyup="parseIdInput(this,event);keyPressed(event,this)" id="kerUid" onfocus="focusInput(this)"/> 39 <textbox id="kerPassword" type="password" value="mm" onfocus="focusInput(this)" onkeyup="keyPressed(event,this)"/> 40 <textbox id="kerOtp" class='otp' type="text" value="OTP " onfocus="focusInput(this)" onkeyup="keyPressed(event,this)" hidden="true"/> 41 <button id="loginBtn" label="Login" oncommand="step1()"/> 42 </vbox> 43 44 <vbox id="console-holder"> 45 <tabpanel id="console-holder"> 46 47 <listbox flex="1" id="kerpass-console" rows="3" suppressonselect="false" context="console-menu"> 48 <listcols> 49 <listcol flex="1"/> 50 </listcols> 51 </listbox> 52 53 <popup id="console-menu"> 54 <menuitem label="Clear" oncommand="clearConsole()"/> 55 <menuitem label="Detailed mode" oncommand="openDetailedConsole()"/> 56 </popup> 57 58 </tabpanel> 59 </vbox> 60 61 <vbox id="logoContainer" flex="1"> 62 <image aign="right" id="logo"/> 63 </vbox> 64 65 </hbox> 56 66 57 </hbox>58 <image aign="right" id="logo" />59 67 </toolbar> 68 69 60 70 </toolbox> 61 71 … … 70 80 </hbox> 71 81 82 <vbox id="appcontent"> 83 <splitter id="advConsole-splitter" class="chromeclass-extrachrome" hidden="true"/> 84 <box flex="1" id="consoleHolder" hidden="true"> 85 <hbox> 86 <vbox> 87 <image id="consoleCloseBtn" class="tabs-closebutton" onclick="closeDetaileConsole(true)" /> 88 </vbox> 89 </hbox> 90 <browser id="consoleWindow" type="content" src="chrome://kerpass/content/detailView.html" flex="1"/> 91 </box> 92 </vbox> 93 72 94 </overlay> 73 95 trunk/client-side/Firefox-extension/chrome/skin/toolbar.css
r3 r6 184 184 width:88px; 185 185 height:88px; 186 background: url("chrome://kerpass/skin/images/gk_logo.png") left center no-repeat; 187 float:right; 186 background: url("chrome://kerpass/skin/images/gk_logo.png") right center no-repeat; 188 187 } 189 188 189 #consoleCloseBtn 190 { 191 position:absolute; 192 } 193 194 195 #consoleWindow 196 { 197 width:100%; 198 } 199

