From 816fc35420a434b1d54ae5833d617608f7456048 Mon Sep 17 00:00:00 2001 From: Clipperz Date: Tue, 08 Jan 2013 15:21:04 +0000 Subject: Updated version of /gamma Tons of changes, included a new draft of the mobile version (still VERY rough) --- (limited to 'frontend/gamma/tests') diff --git a/frontend/gamma/tests/tests/Clipperz/PM/PIN.html b/frontend/gamma/tests/tests/Clipperz/PM/PIN.html new file mode 100644 index 0000000..a08b286 --- a/dev/null +++ b/frontend/gamma/tests/tests/Clipperz/PM/PIN.html @@ -0,0 +1,66 @@ + + + + + Clipperz.PM.Proxy - TEST + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+	
+
+ + diff --git a/frontend/gamma/tests/tests/Clipperz/PM/PIN.test.js b/frontend/gamma/tests/tests/Clipperz/PM/PIN.test.js new file mode 100644 index 0000000..ed795dd --- a/dev/null +++ b/frontend/gamma/tests/tests/Clipperz/PM/PIN.test.js @@ -0,0 +1,97 @@ +/* + +Copyright 2008-2011 Clipperz Srl + +This file is part of Clipperz Community Edition. +Clipperz Community Edition is an online password manager. +For further information about its features and functionalities please +refer to http://www.clipperz.com. + +* Clipperz Community Edition is free software: you can redistribute + it and/or modify it under the terms of the GNU Affero General Public + License as published by the Free Software Foundation, either version + 3 of the License, or (at your option) any later version. + +* Clipperz Community Edition is distributed in the hope that it will + be useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Affero General Public License for more details. + +* You should have received a copy of the GNU Affero General Public + License along with Clipperz Community Edition. If not, see + . + +*/ + +Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose(); + +Clipperz.PM.PIN['CREDENTIALS'] = 'TEST.CLIPPERZ.CREDENTIALS'; +Clipperz.PM.PIN['FAILURE_COUNT'] = 'TEST.CLIPPERZ.FAILED_LOGIN_COUNT'; + + +var tests = { + + //------------------------------------------------------------------------- + + 'clearCredentials': function () { + localStorage.removeItem(Clipperz.PM.PIN['CREDENTIALS']); + localStorage.removeItem(Clipperz.PM.PIN['FAILURE_COUNT']); + }, + + //------------------------------------------------------------------------- + + 'isSet': function () { + tests.clearCredentials(); + + is(false, Clipperz.PM.PIN.isSet(), "after cleaning all values, credentials should not be set"); + + Clipperz.PM.PIN.setCredentialsWithPIN("1234", {'username':'joe', 'passphrase':'eoj'}); + is(true, Clipperz.PM.PIN.isSet(), "once saved, they should be found"); + }, + + 'recordFailedAttempt': function () { + tests.clearCredentials(); + + Clipperz.PM.PIN.setCredentialsWithPIN("1234", {'username':'joe', 'passphrase':'eoj'}); + is(true, Clipperz.PM.PIN.isSet(), "once saved, they should be found"); + Clipperz.PM.PIN.recordFailedAttempt(); + is(true, Clipperz.PM.PIN.isSet(), "1st wrong PIN -> keep credentials"); + Clipperz.PM.PIN.recordFailedAttempt(); + is(true, Clipperz.PM.PIN.isSet(), "2nd wrong PIN -> keep credentials"); + Clipperz.PM.PIN.recordFailedAttempt(); + is(false, Clipperz.PM.PIN.isSet(), "3rd wrong PIN -> REMOVE credentials"); + + Clipperz.PM.PIN.setCredentialsWithPIN("1234", {'username':'joe', 'passphrase':'eoj'}); + is(true, Clipperz.PM.PIN.isSet(), "once saved, they should be found"); + Clipperz.PM.PIN.recordFailedAttempt(); + is(true, Clipperz.PM.PIN.isSet(), "1st wrong PIN -> keep credentials"); + Clipperz.PM.PIN.recordFailedAttempt(); + is(true, Clipperz.PM.PIN.isSet(), "2nd wrong PIN -> keep credentials"); + Clipperz.PM.PIN.resetFailedAttemptCount(); + Clipperz.PM.PIN.recordFailedAttempt(); + is(true, Clipperz.PM.PIN.isSet(), "3rd wrong PIN, but with a successful use in between -> keep credentials"); + }, + + 'credentialsWithPIN': function () { + var credentials; + var pin; + var decryptedCredentials; + + tests.clearCredentials(); + + credentials = {'username': 'joe', 'passphrase':'foobar'}; + pin = '1234'; + Clipperz.PM.PIN.setCredentialsWithPIN(pin, credentials); + decryptedCredentials = Clipperz.PM.PIN.credentialsWithPIN(pin); + + is(decryptedCredentials['username'], credentials['username']); + is(decryptedCredentials['passphrase'], credentials['passphrase']); + }, + + //------------------------------------------------------------------------- + 'syntaxFix': MochiKit.Base.noop +}; + +//############################################################################# + +SimpleTest.runDeferredTests("Clipperz.PM.PIN", tests, {trace:false}); diff --git a/frontend/gamma/tests/tests/Clipperz/PM/index.html b/frontend/gamma/tests/tests/Clipperz/PM/index.html index b9bede1..c3df56a 100644 --- a/frontend/gamma/tests/tests/Clipperz/PM/index.html +++ b/frontend/gamma/tests/tests/Clipperz/PM/index.html @@ -45,6 +45,7 @@ TestRunner.runTests( // 'CryptoPerformance_ByteArrayHex.html', // 'CryptoPerformance_ByteArrayString.html', 'Date.html', + 'PIN.html', 'Proxy.html', 'Toll.html' ); diff --git a/frontend/gamma/tests/tests/Components/FullApp/User.data.js b/frontend/gamma/tests/tests/Components/FullApp/User.data.js index 7194f6a..4dfc81c 100644 --- a/frontend/gamma/tests/tests/Components/FullApp/User.data.js +++ b/frontend/gamma/tests/tests/Components/FullApp/User.data.js @@ -81,7 +81,7 @@ testData = { }, */ /* tt/tt with "fixed" direct login */ -/* 'afaadd70f647886043b9196c861dc04f5605baeab3812ea23707fcba08c4a54f': { + 'afaadd70f647886043b9196c861dc04f5605baeab3812ea23707fcba08c4a54f': { s: 'df781ec363a380a0bb171d7d4c226248259272a964f04fa2340c77ff84bbc594', v: 'eca214d990ec971a61cd9c5082e62c2d241f8e1ec805a2c26b1d31612747bfb0', version: '0.2', @@ -120,7 +120,7 @@ testData = { } } }, -*/ + //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/frontend/gamma/tests/tests/Components/FullApp/index.html b/frontend/gamma/tests/tests/Components/FullApp/index.html index bc00fa7..966a16c 100644 --- a/frontend/gamma/tests/tests/Components/FullApp/index.html +++ b/frontend/gamma/tests/tests/Components/FullApp/index.html @@ -25,19 +25,16 @@ refer to http://www.clipperz.com. - Clipperz - online password manager - debug + FullApp TEST - WEB - - - + - - - + + @@ -196,45 +193,41 @@ Clipperz_normalizedNewLine = '\x0d\x0a'; - + - -
- -
keep it to yourself!
-

loading ...

+
+ +

clipperz

+

keep it to yourself!

+ +
+@js_EMBEDDED@ - -
-
- - -
-
-
-
-
- -
-

Attention!

-

If you can read this message, the chances are that your browser does not properly support JavaScript? or you have disabled this functionality yourself.

-

Javascript is required to access Clipperz.

-
Please enable scripting or upgrade your browser.
-
-
- -
- + + + diff --git a/frontend/gamma/tests/tests/Components/FullApp/main_test.js b/frontend/gamma/tests/tests/Components/FullApp/main_test.js deleted file mode 100644 index b13972a..0000000 --- a/frontend/gamma/tests/tests/Components/FullApp/main_test.js +++ b/dev/null @@ -1,111 +0,0 @@ -/* - -Copyright 2008-2011 Clipperz Srl - -This file is part of Clipperz Community Edition. -Clipperz Community Edition is an online password manager. -For further information about its features and functionalities please -refer to http://www.clipperz.com. - -* Clipperz Community Edition is free software: you can redistribute - it and/or modify it under the terms of the GNU Affero General Public - License as published by the Free Software Foundation, either version - 3 of the License, or (at your option) any later version. - -* Clipperz Community Edition is distributed in the hope that it will - be useful, but WITHOUT ANY WARRANTY; without even the implied - warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Affero General Public License for more details. - -* You should have received a copy of the GNU Affero General Public - License along with Clipperz Community Edition. If not, see - . - -*/ - -function _pm_logEvent(anEvent) { -// console.log("####", anEvent); - - anEvent.preventDefault(); -} - -function handleGenericDeferredError(anError) { - var result; - - if (anError instanceof MochiKit.Async.CancelledError) { - result = anError; - } else { -MochiKit.Logging.logError("## MainController - GENERIC ERROR" + "\n" + "==>> " + anError + " <<==\n" + anError.stack); -//console.log(anError); - result = new MochiKit.Async.CancelledError(anError); - } - - return result; -} - - -Clipperz.PM.RunTime = {}; - - -function run() { - var shouldShowRegistrationForm; - var useCompactDesign; - var controllerParameters; -// var iPhoneDesign; - -// MochiKit.Signal.connect(document.body, 'onkeydown', _pm_logEvent); -// MochiKit.Signal.connect(document.body, 'onkeypress', _pm_logEvent); -// MochiKit.Signal.connect(document.body, 'onclick', _pm_logEvent); - - controllerParameters = {}; - - MochiKit.DOM.removeElement('javaScriptAlert'); - Clipperz.PM.Strings.Languages.initSetup(); - - if (window.location.search.indexOf('registration') != -1) { - shouldShowRegistrationForm = true; - } else { - shouldShowRegistrationForm = false; - } - - if (window.location.search.indexOf('autocomplete') != -1) { - controllerParameters['autocomplete'] = 'on' - } - -// if ((window.location.search.indexOf('iPhone') != -1) || (navigator.userAgent.match('iPhone'))) { -// iPhoneDesign = true; -// } else { -// iPhoneDesign = false; -// } - - if (window.location.search.indexOf('compact') != -1) { - useCompactDesign = true; - } else { - useCompactDesign = false; - } - - if (useCompactDesign == true) { - Clipperz.PM.RunTime.mainController = new Clipperz.PM.UI.Compact.Controllers.MainController(controllerParameters); -// } else if (iPhoneDesign == true) { -// Clipperz.PM.RunTime.mainController = new Clipperz.PM.UI.iPhone.Controllers.MainController(); - } else { - Clipperz.PM.RunTime.mainController = new Clipperz.PM.UI.Web.Controllers.MainController(controllerParameters); - } - - Clipperz.PM.RunTime.mainController.run(shouldShowRegistrationForm); - -//Clipperz.log("HASH: " + window.location.hash); -// if (window.location.hash != "") { -// window.location.hash = "" -// } -//Clipperz.log("HASH cleaned"); -// #credentials=base64encoded({username:'joe', passphrase:'clipperz'}) -// MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'doLogin', {username:'joe', passphrase:'clipperz'}); -} - -Clipperz.Crypto.PRNG.defaultRandomGenerator().fastEntropyAccumulationForTestingPurpose(); - -var proxy = new Clipperz.PM.Proxy.Test({shouldPayTolls:true, isDefault:true, readOnly:false}); -proxy.dataStore().setupWithEncryptedData(testData['testData']); - -MochiKit.DOM.addLoadEvent(run); diff --git a/frontend/gamma/tests/tests/Components/FullApp/mobile.index.html b/frontend/gamma/tests/tests/Components/FullApp/mobile.index.html new file mode 100644 index 0000000..818e3d6 --- a/dev/null +++ b/frontend/gamma/tests/tests/Components/FullApp/mobile.index.html @@ -0,0 +1,204 @@ + + + + + + + + FullApp TEST - MOBILE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +

clipperz

+

keep it to yourself!

+ +
+
+ +
+ + + + + + -- cgit v0.9.0.2