Merge lp:~joep-moritz-13/study.cs.ucl-password-collection-clients/study.cs.ucl-password-collection-clients into lp:study.cs.ucl-password-collection-clients

Proposed by joep.moritz.13
Status: Merged
Approved by: Steve Dodier-Lazaro
Approved revision: 115
Merged at revision: 114
Proposed branch: lp:~joep-moritz-13/study.cs.ucl-password-collection-clients/study.cs.ucl-password-collection-clients
Merge into: lp:study.cs.ucl-password-collection-clients
Diff against target: 50 lines (+17/-2)
1 file modified
js/MonitorService.js (+17/-2)
To merge this branch: bzr merge lp:~joep-moritz-13/study.cs.ucl-password-collection-clients/study.cs.ucl-password-collection-clients
Reviewer Review Type Date Requested Status
Steve Dodier-Lazaro Approve
Review via email: mp+263635@code.launchpad.net

Description of the change

Now ignores duplicate entry made in last minute (matches pw hash and url).

To post a comment you must log in.
Revision history for this message
Steve Dodier-Lazaro (sidi) :
review: Approve
Revision history for this message
Steve Dodier-Lazaro (sidi) wrote :

I am realising now that it would have been important to also match the user id. Turning this into a bug report for the future.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'js/MonitorService.js'
2--- js/MonitorService.js 2015-07-01 17:05:08 +0000
3+++ js/MonitorService.js 2015-07-02 10:54:52 +0000
4@@ -39,7 +39,7 @@
5 function getNumCharClasses(password) {
6
7 var numCharClasses = 0;
8- angular.forEach([/[A-Z]/, /[a-z]/, /\d/, /[!"#\$%&'()\*\+,-\./:;<=>\?@\[\\\]\^_`{|}~]/], function (expr) {
9+ angular.forEach([/[A-Z]/, /[a-z]/, /\d/, /[!"#\$%&'()\*\+,-\./:;<=>\?@\[\\\]\^_`{|}~]/], function (expr) { // "
10
11 if (password.match(expr)) {
12
13@@ -70,6 +70,10 @@
14
15 return {
16
17+ lastPasswordHash: '',
18+ lastTime: 0,
19+ lastURL: '',
20+
21 newPassword: function (url, username, password, time, timeSpent) {
22
23 if (url && username && password && time && timeSpent && !TimerService.isSuspended()) {
24@@ -81,7 +85,7 @@
25 }
26 }
27 }
28- // console.log("Submitting " + username + " // " + password);
29+ console.log("Submitting " + username + " // " + password);
30 var pwdHash, unHash;
31 $q.all({
32 username: HashingService.hashThis(username),
33@@ -89,6 +93,17 @@
34 }).then(function (results) {
35 pwdHash = results.password;
36 unHash = (username === 'unknown') ? username : results.username;
37+
38+ // To prevent duplicate entries
39+ if (this.lastPasswordHash === pwdHash && this.lastTime > time - 60000 && this.lastURL === url)
40+ {
41+ console.log("Skipping duplicate entry for " + url);
42+ return $q.reject();
43+ }
44+ this.lastPasswordHash = pwdHash;
45+ this.lastTime = time;
46+ this.lastURL = url;
47+
48 IdbService.insertNewUsageEntry(unHash, pwdHash, url, time, timeSpent);
49 return IdbService.hasPasswordAlready(pwdHash);
50 }).then(function (hasPasswordAlready) {

Subscribers

People subscribed via source and target branches