Skip to content

Commit

Permalink
server refactor
Browse files Browse the repository at this point in the history
fixed userpage's checksum;
refactored server codes;
  • Loading branch information
edithli committed May 21, 2016
1 parent 32b2f65 commit 1e32291
Show file tree
Hide file tree
Showing 86 changed files with 12,393 additions and 1 deletion.
15 changes: 14 additions & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,20 @@ chrome.runtime.onMessage.addListener(function(request, sender, sendResponse){
console.log("cipherChecksum: " + cipherChecksum);
sendResponse({cipherChecksum: cipherChecksum});
}
} else if (url == USER_PAGE_URL) {
if (request.checkURL){
if (!checksum)
console.error("problem with userpage's checksum");
sendResponse({userpage: true, checksum: checksum});
} else if (request.decryption) {
var list = request.content;
for (var i = 0; i < list.length; i++){
list[i] = decryptPwd(mpw, list[i]);
}
sendResponse({content: list});
}
} else if (request.checkURL){
// check login first !!!!!!!!!!
// check login first
if (!username || !mpw){
sendResponse({nothing: true});
} else {
Expand Down Expand Up @@ -203,6 +215,7 @@ var mpw, username, checksum;
var IV_BIT_LEN = 128;
var LOGIN_URL = "http://localhost:8080/pm-server/login.html";
var REGISTER_URL = "http://localhost:8080/pm-server/register.html";
var USER_PAGE_URL = "http://localhost:8080/pm-server/userpage.jsp";
var DATA_SERVER_URL = "http://localhost:8080/pm-server/AddAccountServlet";
var URL_QUERY_URL = "http://localhost:8080/pm-server/QueryURLServlet";

Expand Down
25 changes: 25 additions & 0 deletions content_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,31 @@ chrome.runtime.sendMessage({checkURL: true}, function(response){
document.getElementById("register-form").submit();
});
});
} else if (response.userpage) {
var checksum = response.checksum;
document.getElementById("checksum").textContent = checksum;
var ctpwds = document.getElementsByClassName("password");
var list = new Array(ctpwds.length), ptpwds;
for (var i = 0; i < ctpwds.length; i++) {
list[i] = ctpwds[i].innerText;
}
var status = 0;
chrome.runtime.sendMessage({decryption: true, content: list}, function(response){
ptpwds = response.content;
document.getElementById("show-password").addEventListener('click', function(){
status = 1;
for (var i = 0; i < ctpwds.length; i++){
ctpwds[i].innerText = ptpwds[i];
}
});
document.getElementById("hide-password").addEventListener('click', function(){
if (status == 1){
for (var i = 0; i < ctpwds.length; i++)
ctpwds[i].innerText = list[i];
status = 0;
}
});
});
} else if (response.autofill){
var username = response.username;
var thisurl = response.url;
Expand Down
4 changes: 4 additions & 0 deletions extension/client/background/background.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!DOCTYPE html>
<script src="background.js"></script>
<script src="sjcl.js"></script>
<script src="ctr.js"></script>
Loading

0 comments on commit 1e32291

Please sign in to comment.