summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js
Side-by-side diff
Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js') (more/less context) (show whitespace changes)
-rw-r--r--frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js28
1 files changed, 10 insertions, 18 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js
index 7db6888..b70aa17 100644
--- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js
+++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/NewUserWizardController.js
@@ -1,46 +1,44 @@
/*
-Copyright 2008-2011 Clipperz Srl
+Copyright 2008-2013 Clipperz Srl
-This file is part of Clipperz Community Edition.
-Clipperz Community Edition is an online password manager.
+This file is part of Clipperz, the 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 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.
+* Clipperz 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
- <http://www.gnu.org/licenses/>.
+ License along with Clipperz. If not, see http://www.gnu.org/licenses/.
*/
Clipperz.Base.module('Clipperz.PM.UI.Web.Controllers');
Clipperz.PM.UI.Web.Controllers.NewUserWizardController = function(args) {
this._newUserCreationComponent = args.newUserCreationComponent || Clipperz.Base.exception.raise('MandatoryParameter');
MochiKit.Signal.connect(this._newUserCreationComponent, 'changedValue', this, 'handleChangedValue');
MochiKit.Signal.connect(this._newUserCreationComponent, 'moveForward', this, 'handleMoveForward');
MochiKit.Signal.connect(this._newUserCreationComponent, 'keyPressed', this, 'handleNewUserCreationComponentKeyPressed');
this._rulerComponent = null;
this._steps = null;
this._currentStepIndex = 0;
this._isNextEnabled = false;
this._userCreationState = 'IDLE'; // 'IN PROGRESS', 'DONE', 'FAILED'
this._user = null;
return this;
}
MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prototype, {
@@ -51,49 +49,48 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prot
//-------------------------------------------------------------------------
'newUserCreationComponent': function () {
return this._newUserCreationComponent;
},
//=============================================================================
'user': function () {
return this._user;
},
'setUser': function (aValue) {
this._user = aValue;
},
//-----------------------------------------------------------------------------
'userCreationState': function () {
return this._userCreationState;
},
'setUserCreationState': function (aValue) {
-//console.log("+++ NewUserWizardController.setUserCreationState", aValue);
this._userCreationState = aValue;
this.checkState();
},
//=============================================================================
'resetCurrentStepIndex': function () {
this._currentStepIndex = 0;
this.rulerComponent().resetStatus({animateTransition:true});
},
//-----------------------------------------------------------------------------
'enableNext': function (aValue) {
this.rulerComponent().enableNext(aValue);
this._isNextEnabled = aValue;
},
'isNextEnabled': function () {
return this._isNextEnabled;
},
//-----------------------------------------------------------------------------
@@ -201,58 +198,55 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prot
enableNext = false;
this.newUserCreationComponent().disableAllPanels();
switch(this.currentStep()) {
case 'CREDENTIALS':
this.newUserCreationComponent().enableCredentialsPanel();
enableNext = (
(this.newUserCreationComponent().username() != '')
&&
(this.newUserCreationComponent().passphrase() != '')
);
// enablePrevious = false;
break;
case 'CHECK_CREDENTIALS':
this.newUserCreationComponent().enableCheckCredentialsPanel();
enableNext = (this.newUserCreationComponent().passphrase() == this.newUserCreationComponent().rePassphrase());
// enablePrevious = true;
break
case 'TERMS_OF_SERVICE':
this.newUserCreationComponent().enableTermsOfServicePanel();
-//console.log("awareOfUnrecoverablePassphrase", this.newUserCreationComponent().awareOfUnrecoverablePassphrase());
-//console.log("readTermsOfService", this.newUserCreationComponent().readTermsOfService());
enableNext = (
(this.newUserCreationComponent().awareOfUnrecoverablePassphrase() == 'on')
&&
(this.newUserCreationComponent().readTermsOfService() == 'on')
)
break;
case 'CREATE_USER':
-//console.log(">>> CREATE_USER", this.userCreationState());
this.newUserCreationComponent().enableCreateUserPanel();
switch (this.userCreationState()) {
case 'IDLE':
this.setUserCreationState('IN PROGRESS');
this.preformActualUserRegistration();
enablePrevious = false;
enableNext = false;
break;
case 'IN PROGRESS':
enablePrevious = false;
enableNext = false;
break;
case 'DONE':
enablePrevious = false;
enableNext = true;
break;
case 'FAILED':
enablePrevious = true;
enableNext = false;
break;
};
break;
@@ -316,49 +310,48 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prot
// MochiKit.Base.method(this.newUserCreationComponent(), 'resetContent'),
Clipperz.Async.forkAndJoin("NewUserWizardController.handleExit - fork and join", [
MochiKit.Base.method(this, 'hideRuler'),
MochiKit.Base.method(this.newUserCreationComponent(), 'deferredHideModal')
], {trace:false}),
MochiKit.Base.method(this, 'resetRuler'),
// MochiKit.Base.method(this.newUserCreationComponent(), 'reset'),
MochiKit.Base.partial(MochiKit.Signal.signal, this, 'exit')
], {trace:false})
},
'done': function () {
this.doneWithRuler();
MochiKit.Signal.signal(this, 'done', {'user': this.user()});
},
//=============================================================================
'handleMoveBackward': function () {
if (this._currentStepIndex > 0) {
var afterMoveAction;
afterMoveAction = MochiKit.Base.noop;
-//console.log("<-- backward", this.currentStep());
switch(this.currentStep()) {
case 'CREDENTIALS':
case 'CHECK_CREDENTIALS':
case 'TERMS_OF_SERVICE':
this._currentStepIndex --;
this.rulerComponent().moveBackward(afterMoveAction);
break;
case 'CREATE_USER':
this.setUser(null);
this.newUserCreationComponent().hideAllProgeressStates();
this.resetCurrentStepIndex();
this.setUserCreationState('IDLE');
break;
// case 'LOGIN':
// break;
};
}
if (this._currentStepIndex == 0) {
this.enablePrevious(false);
}
},
@@ -385,49 +378,48 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.NewUserWizardController.prot
this.rulerComponent().moveForward(afterMoveAction);
};
},
'handleCursorMoved': function () {
// this.checkState();
// this.setFocus();
return Clipperz.Async.callbacks("NewUserWizardController.handleCursorMoved", [
MochiKit.Base.method(this.newUserCreationComponent(), 'waitUntilFullyRendered'),
MochiKit.Base.method(this, 'checkState'),
MochiKit.Base.method(this, 'setFocus')
], {trace:false});
},
//-------------------------------------------------------------------------
'handleChangedValue': function (anEvent) {
this.checkState();
},
//-------------------------------------------------------------------------
'handleNewUserCreationComponentKeyPressed': function (anEvent) {
-//console.log(">>> handleNewUserCreationComponentKeyPressed", anEvent.key().string);
if (anEvent.key().string == 'KEY_ENTER') {
if (anEvent.target().nodeName != 'TEXTAREA') {
anEvent.preventDefault();
this.handleMoveForward();
}
} else if (anEvent.key().string == 'KEY_TAB') {
if (anEvent.target() == this.newUserCreationComponent().usernameElement()) {
} else {
this.handleMoveForward();
if ((anEvent.target().nodeName == 'INPUT') || (anEvent.target().nodeName == 'TEXTAREA')) {
anEvent.preventDefault();
}
}
} else if ((anEvent.key().string == 'KEY_ARROW_RIGHT') && (anEvent.modifier().meta == true)) {
this.handleMoveForward();
} else if ((anEvent.key().string == 'KEY_ARROW_LEFT') && (anEvent.modifier().meta == true)) {
this.handleMoveBackward();
} else if (anEvent.key().string == 'KEY_ESCAPE') {
anEvent.stop();
this.handleExit();
} else {
MochiKit.Async.callLater(0.1, MochiKit.Base.method(this, 'checkState'));
}
},