Diffstat (limited to 'frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js') (more/less context) (show whitespace changes)
-rw-r--r-- | frontend/gamma/js/Clipperz/PM/UI/Web/Controllers/LoginController.js | 6 |
1 files changed, 0 insertions, 6 deletions
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 | |||
@@ -60,71 +60,65 @@ MochiKit.Base.update(Clipperz.PM.UI.Web.Controllers.LoginController.prototype, { | |||
60 | 60 | ||
61 | //----------------------------------------------------------------------------- | 61 | //----------------------------------------------------------------------------- |
62 | 62 | ||
63 | 'run': function(args) { | 63 | 'run': function(args) { |
64 | varslot; | 64 | varslot; |
65 | varloginPage; | 65 | varloginPage; |
66 | varloginForm; | 66 | varloginForm; |
67 | 67 | ||
68 | slot = args.slot; | 68 | slot = args.slot; |
69 | 69 | ||
70 | loginForm =new Clipperz.PM.UI.Web.Components.LoginForm({'autocomplete': this.args()['autocomplete']}); | 70 | loginForm =new Clipperz.PM.UI.Web.Components.LoginForm({'autocomplete': this.args()['autocomplete']}); |
71 | 71 | ||
72 | slot.setContent(this.loginPage()); | 72 | slot.setContent(this.loginPage()); |
73 | this.loginPage().slotNamed('loginForm').setContent(loginForm); | 73 | this.loginPage().slotNamed('loginForm').setContent(loginForm); |
74 | 74 | ||
75 | MochiKit.Signal.connect(loginForm, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); | 75 | MochiKit.Signal.connect(loginForm, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); |
76 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); | 76 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'doLogin', MochiKit.Base.method(this, 'doLogin', loginForm)); |
77 | }, | 77 | }, |
78 | 78 | ||
79 | //----------------------------------------------------------------------------- | 79 | //----------------------------------------------------------------------------- |
80 | 80 | ||
81 | 'doLogin': function(aLoginForm, anEvent) { | 81 | 'doLogin': function(aLoginForm, anEvent) { |
82 | var deferredResult; | 82 | var deferredResult; |
83 | varparameters; | 83 | varparameters; |
84 | // varshouldUseOTP; | ||
85 | var loginProgress; | 84 | var loginProgress; |
86 | varuser; | 85 | varuser; |
87 | var getPassphraseDelegate; | 86 | var getPassphraseDelegate; |
88 | 87 | ||
89 | parameters = anEvent; | 88 | parameters = anEvent; |
90 | // shouldUseOTP = (typeof(parameters.passphrase) == 'undefined'); | ||
91 | 89 | ||
92 | getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, parameters.passphrase); | 90 | getPassphraseDelegate = MochiKit.Base.partial(MochiKit.Async.succeed, parameters.passphrase); |
93 | user = new Clipperz.PM.DataModel.User({'username':parameters.username, 'getPassphraseFunction':MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase')}); | 91 | user = new Clipperz.PM.DataModel.User({'username':parameters.username, 'getPassphraseFunction':MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'getPassphrase')}); |
94 | 92 | ||
95 | loginProgress = new Clipperz.PM.UI.Web.Components.LoginProgress(); | 93 | loginProgress = new Clipperz.PM.UI.Web.Components.LoginProgress(); |
96 | 94 | ||
97 | deferredResult = new Clipperz.Async.Deferred("LoginController.doLogin", {trace:false}); | 95 | deferredResult = new Clipperz.Async.Deferred("LoginController.doLogin", {trace:false}); |
98 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); | 96 | deferredResult.addCallbackPass(MochiKit.Signal.signal, Clipperz.Signal.NotificationCenter, 'initProgress', {'steps':4}); |
99 | deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', getPassphraseDelegate); | 97 | deferredResult.addMethod(Clipperz.PM.RunTime.mainController, 'setPassphraseDelegate', getPassphraseDelegate); |
100 | deferredResult.addMethod(loginProgress, 'deferredShowModal', {deferredObject:deferredResult, openFromElement:aLoginForm.submitButtonElement()}); | 98 | deferredResult.addMethod(loginProgress, 'deferredShowModal', {deferredObject:deferredResult, openFromElement:aLoginForm.submitButtonElement()}); |
101 | deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); | 99 | deferredResult.addMethod(Clipperz.Crypto.PRNG.defaultRandomGenerator(), 'deferredEntropyCollection'); |
102 | // if (shouldUseOTP == false) { | ||
103 | deferredResult.addMethod(user, 'login'); | 100 | deferredResult.addMethod(user, 'login'); |
104 | // } else { | ||
105 | // deferredResult.addMethod(user, 'loginUsingOTP', parameters.username, parameters.otp); | ||
106 | // } | ||
107 | deferredResult.addCallback(function(aLoginProgress, res) { | 101 | deferredResult.addCallback(function(aLoginProgress, res) { |
108 | aLoginProgress.disableCancel(); | 102 | aLoginProgress.disableCancel(); |
109 | return res; | 103 | return res; |
110 | }, loginProgress); | 104 | }, loginProgress); |
111 | deferredResult.addCallback(function () { | 105 | deferredResult.addCallback(function () { |
112 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN',MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:MochiKit.DOM.currentDocument().body})); | 106 | MochiKit.Signal.connect(Clipperz.Signal.NotificationCenter, 'CARDS_CONTROLLER_DID_RUN',MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:MochiKit.DOM.currentDocument().body})); |
113 | }) | 107 | }) |
114 | deferredResult.addMethod(this, 'userLoggedIn', user, loginProgress, aLoginForm); | 108 | deferredResult.addMethod(this, 'userLoggedIn', user, loginProgress, aLoginForm); |
115 | deferredResult.addErrback (MochiKit.Base.method(this, 'handleFailedLogin', loginProgress)); | 109 | deferredResult.addErrback (MochiKit.Base.method(this, 'handleFailedLogin', loginProgress)); |
116 | 110 | ||
117 | deferredResult.addErrback (MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:aLoginForm.submitButtonElement()})); | 111 | deferredResult.addErrback (MochiKit.Base.method(loginProgress, 'deferredHideModalAndRemove', {closeToElement:aLoginForm.submitButtonElement()})); |
118 | deferredResult.addErrbackPass (MochiKit.Base.method(aLoginForm, 'focusOnPassphraseField')); | 112 | deferredResult.addErrbackPass (MochiKit.Base.method(aLoginForm, 'focusOnPassphraseField')); |
119 | deferredResult.addBoth(MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'removePassphraseDelegate', getPassphraseDelegate)); | 113 | deferredResult.addBoth(MochiKit.Base.method(Clipperz.PM.RunTime.mainController, 'removePassphraseDelegate', getPassphraseDelegate)); |
120 | deferredResult.callback(); | 114 | deferredResult.callback(); |
121 | 115 | ||
122 | MochiKit.Signal.connect(loginProgress, 'cancelEvent', deferredResult, 'cancel'); | 116 | MochiKit.Signal.connect(loginProgress, 'cancelEvent', deferredResult, 'cancel'); |
123 | 117 | ||
124 | return deferredResult; | 118 | return deferredResult; |
125 | }, | 119 | }, |
126 | 120 | ||
127 | //----------------------------------------------------------------------------- | 121 | //----------------------------------------------------------------------------- |
128 | 122 | ||
129 | 'userLoggedIn': function(aUser) { | 123 | 'userLoggedIn': function(aUser) { |
130 | //Clipperz.log(">>> LoginController.userLoggedIn"); | 124 | //Clipperz.log(">>> LoginController.userLoggedIn"); |