summaryrefslogtreecommitdiffstats
path: root/install/ui/src/freeipa/widgets/LoginScreen.js
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2014-02-20 18:05:16 +0100
committerPetr Vobornik <pvoborni@redhat.com>2014-04-15 12:41:54 +0200
commit937533c48e27c5a8d4d63978d32990451a10a36a (patch)
tree22c710970e69f1ea3196306d3d33a3e220830b7b /install/ui/src/freeipa/widgets/LoginScreen.js
parent2ec5d969a27b91b04a2b424d93800e68a77aa6e8 (diff)
downloadfreeipa-937533c48e27c5a8d4d63978d32990451a10a36a.tar.gz
freeipa-937533c48e27c5a8d4d63978d32990451a10a36a.tar.xz
freeipa-937533c48e27c5a8d4d63978d32990451a10a36a.zip
webui: use asynchronous call for authentication
Change `IPA.login_password` and `IPA.get_credentials` to use async AJAX and to return promise instead of blocking the code. IPA.get_credentials is still partially blocking because of negotiate process. We can't do anything about that. It allows activity indicators to do their job. https://fedorahosted.org/freeipa/ticket/3903 Reviewed-By: Adam Misnyovszki <amisnyov@redhat.com>
Diffstat (limited to 'install/ui/src/freeipa/widgets/LoginScreen.js')
-rw-r--r--install/ui/src/freeipa/widgets/LoginScreen.js40
1 files changed, 21 insertions, 19 deletions
diff --git a/install/ui/src/freeipa/widgets/LoginScreen.js b/install/ui/src/freeipa/widgets/LoginScreen.js
index 9d149af4c..560393f45 100644
--- a/install/ui/src/freeipa/widgets/LoginScreen.js
+++ b/install/ui/src/freeipa/widgets/LoginScreen.js
@@ -337,14 +337,14 @@ define(['dojo/_base/declare',
login_with_kerberos: function() {
- var status = IPA.get_credentials();
-
- if (status === 200) {
- this.emit('logged_in');
- } else {
- var val_summary = this.get_widget('validation');
- val_summary.add_error('login', this.krb_auth_failed);
- }
+ IPA.get_credentials().then(lang.hitch(this, function(status) {
+ if (status === 200) {
+ this.emit('logged_in');
+ } else {
+ var val_summary = this.get_widget('validation');
+ val_summary.add_error('login', this.krb_auth_failed);
+ }
+ }));
},
login_with_password: function() {
@@ -356,18 +356,20 @@ define(['dojo/_base/declare',
var password_f = this.get_field('password');
var password = password_f.get_value()[0];
- var result = IPA.login_password(login, password);
+ IPA.login_password(login, password).then(
+ lang.hitch(this, function(result) {
- if (result === 'success') {
- this.emit('logged_in');
- password_f.set_value('');
- } else if (result === 'password-expired') {
- this.set('view', 'reset');
- val_summary.add_error('login', this.password_expired);
- } else {
- val_summary.add_error('login', this.form_auth_failed);
- password_f.set_value('');
- }
+ if (result === 'success') {
+ this.emit('logged_in');
+ password_f.set_value('');
+ } else if (result === 'password-expired') {
+ this.set('view', 'reset');
+ val_summary.add_error('login', this.password_expired);
+ } else {
+ val_summary.add_error('login', this.form_auth_failed);
+ password_f.set_value('');
+ }
+ }));
},
login_and_reset: function() {