Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web') (more/less context) (ignore whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js | 52 | ||||
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js | 8 |
2 files changed, 16 insertions, 44 deletions
diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js index 389d876..a10ba4f 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Components/LoginForm.js @@ -52,50 +52,35 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginForm, Clipperz.PM.UI.Com 'autocomplete': function () { return this._autocomplete; }, //------------------------------------------------------------------------- 'renderSelf': function() { this.append(this.element(), {tag:'div', id:'loginBox', children:[ {tag:'div', cls:'header'}, {tag:'div', cls:'body', id:this.getId('body'), children:[ {tag:'div', id:this.getId('loginForm'), children:[ {tag:'div', children:[ {tag:'h4', html:'Login'}, // {tag:'form', cls:'loginForm', autocomplete:this.autocomplete(), children:[ {tag:'form', id:this.getId('form'), cls:'loginForm', children:[ {tag:'label', html:'username', 'for':this.getId('usernameField')}, - {tag:'input', id:this.getId('usernameField'), type:'text', cls:'username'/*, value:'joe'*/}, - {tag:'ul', id:this.getId('passwordOptions'), children:[ - {tag:'li', id:this.getId('passphraseOption'), children:[ - {tag:'label', html:'passphrase / OTP', 'for':this.getId('passphraseField')}, - {tag:'input', id:this.getId('passphraseField'), type:'password', cls:'password'/*, value:'clipperz'*/} - ]} // , -/* - {tag:'li', id:this.getId('otpOption'), children:[ - {tag:'label', html:'one-time password', 'for':this.getId('otpField_1')}, - {tag:'input', id:this.getId('otpField_1'), type:'text', cls:'otp', value:'abcd-efgh'}, - {tag:'input', id:this.getId('otpField_2'), type:'text', cls:'otp', value:'abcd-efgh'}, - {tag:'input', id:this.getId('otpField_3'), type:'text', cls:'otp', value:'abcd-efgh'}, - {tag:'input', id:this.getId('otpField_4'), type:'text', cls:'otp', value:'abcd-efgh'} - ]} -*/ - ]}, -// {tag:'input', id:this.getId('otpCheckbox'), type:'checkbox', cls:'checkbox'}, -// {tag:'label', html:'use a one-time passphrase', 'for':this.getId('otpCheckbox'), cls:'checkbox'}, + {tag:'input', id:this.getId('usernameField'), type:'text', cls:'username'}, + {tag:'label', html:'passphrase / OTP', 'for':this.getId('passphraseField')}, + {tag:'input', id:this.getId('passphraseField'), type:'password', cls:'password'}, {tag:'div', cls:'translations', children:[ {tag:'h4', html:'choose your language'}, {tag:'ul', children:[ {tag:'li', cls:'selected', html:'english'}, {tag:'li', html:'italiano'}, {tag:'li', html:'dutch'}, {tag:'li', html:'french'}, {tag:'li', html:'spanish'}, {tag:'li', html:'chinese'}, {tag:'li', html:'japanese'}, {tag:'li', html:'portugal'}, {tag:'li', html:'arabic'} ]} ]}, @@ -148,53 +133,46 @@ Clipperz.Base.extend(Clipperz.PM.UI.Web.Components.LoginForm, Clipperz.PM.UI.Com 'focusOnPassphraseField': function () { this.getElement('passphraseField').focus(); this.getElement('passphraseField').select(); }, //----------------------------------------------------------------------------- /* 'showOTPFields': function() { this.hideElement('passphraseOption'); this.showElement('otpOption'); }, */ //------------------------------------------------------------------------- 'loginEventHandler': function(anEvent) { - var username; - var passphrase; -// var shouldUseOTP; -// var otp; +// var username; +// var passphrase; var signalArguments; anEvent.preventDefault(); - username = this.getElement('usernameField').value; - passphrase = this.getElement('passphraseField').value; -// otp = this.getElement('otpField_1').value + -// this.getElement('otpField_2').value + -// this.getElement('otpField_3').value + -// this.getElement('otpField_4').value; -// shouldUseOTP = this.getElement('otpCheckbox').checked; - - signalArguments = {username:username}; - -// if (shouldUseOTP) { -// signalArguments.otp = otp; -// } else { - signalArguments.passphrase = passphrase; -// } +// username = this.getElement('usernameField').value; +// passphrase = this.getElement('passphraseField').value; + +// signalArguments = {username:username}; +// signalArguments.passphrase = passphrase; + + signalArguments = { + 'username': this.getElement('usernameField').value, + 'passphrase': this.getElement('passphraseField').value + }; MochiKit.Signal.signal(this, 'doLogin', signalArguments); }, //------------------------------------------------------------------------- 'submitButtonElement': function() { return this.getElement('submitButton'); }, //------------------------------------------------------------------------- __syntaxFix__: "syntax fix" }); diff --git a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js index d0b378c..a57152d 100644 --- a/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js +++ b/frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js @@ -68,55 +68,49 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.LoginController.prototype, { slot = args.slot; loginForm = new Clipperz.PM.UI.Web.Components.LoginForm({'autocomplete': this.args()['autocomplete']}); slot.setContent(this.loginPage()); this.loginPage().slotNamed('loginForm').setContent(loginForm); MochiKit.Signal.connect(loginForm, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); }, //----------------------------------------------------------------------------- 'doLogin': function(aLoginForm, anEvent) { var deferredResult; var parameters; -// var shouldUseOTP; var loginProgress; var user; var getPassphraseDelegate; parameters = anEvent; -// shouldUseOTP = (typeof(parameters.passphrase) == 'undefined'); getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, parameters.passphrase); user = new Clipperz.PM.DataModel.User({'username':parameters.username, 'getPassphraseFunction':MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase')}); loginProgress = new Clipperz.PM.UI.Web.Components.LoginProgress(); deferredResult = new Clipperz.Async.Deferred("LoginController.doLogin", {trace:false}); deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', getPassphraseDelegate); deferredResult.addMethod(loginProgress, 'deferredShowModal', {deferredObject:deferredResult, openFromElement:aLoginForm.submitButtonElement()}); deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); -// if (shouldUseOTP == false) { - deferredResult.addMethod(user, 'login'); -// } else { -// deferredResult.addMethod(user, 'loginUsingOTP', parameters.username, parameters.otp); -// } + deferredResult.addMethod(user, 'login'); deferredResult.addCallback(function(aLoginProgress, res) { aLoginProgress.disableCancel(); return res; }, loginProgress); deferredResult.addCallback(function () { MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN', MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:MochiKit.DOM.currentDocument().body})); }) deferredResult.addMethod(this, 'userLoggedIn', user, loginProgress, aLoginForm); deferredResult.addErrback (MochiKit.Base.method(this, 'handleFailedLogin', loginProgress)); deferredResult.addErrback (MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:aLoginForm.submitButtonElement()})); deferredResult.addErrbackPass (MochiKit.Base.method(aLoginForm, 'focusOnPassphraseField')); deferredResult.addBoth(MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'removePassphraseDelegate', getPassphraseDelegate)); deferredResult.callback(); MochiKit.Signal.connect(loginProgress, 'cancelEvent', deferredResult, 'cancel'); |