From fe6fb7186ddd57c951ef3c5e692deeae8a48d9e6 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Sun, 6 May 2012 23:10:27 -0400 Subject: registration working now --- alias-angular/app/index.html | 9 +++++---- alias-angular/app/js/controllers.js | 21 +++++++++++---------- alias-angular/app/js/services.js | 4 +++- 3 files changed, 19 insertions(+), 15 deletions(-) (limited to 'alias-angular') diff --git a/alias-angular/app/index.html b/alias-angular/app/index.html index 5437815..e95a337 100644 --- a/alias-angular/app/index.html +++ b/alias-angular/app/index.html @@ -18,8 +18,8 @@
@@ -94,11 +94,12 @@ - - + + diff --git a/alias-angular/app/js/controllers.js b/alias-angular/app/js/controllers.js index 1fca239..144bd8b 100644 --- a/alias-angular/app/js/controllers.js +++ b/alias-angular/app/js/controllers.js @@ -52,11 +52,11 @@ function ConnectCtl($scope, StropheSrv, $log, $rootScope) { }; function onRegister(iq) { - var form = $(iq).find('query x'); + $scope.form = $(iq).find('query x'); if ($(iq).find('registered').length !== 0){ // user is registered, get the info from the form - var pubkey = form.find('field[var="pubkey"] > value').text(); - var privkey = form.find('field[var="privkey"] > value').text(); + var pubkey = $scope.form.find('field[var="pubkey"] > value').text(); + var privkey = $scope.form.find('field[var="privkey"] > value').text(); privkey = sjcl.decrypt($scope.password, privkey); pubkey = JSON.parse(pubkey); privkey = JSON.parse(privkey); @@ -67,7 +67,7 @@ function ConnectCtl($scope, StropheSrv, $log, $rootScope) { privkey.dq, privkey.c); $rootScope.alias.rsa_key = rsa_key; }else{ - $("#register .modal-body").append(form.xmppForm('render')); + $("#register .modal-body").append($scope.form.xmppForm('render')); $("#register").modal("show"); } }; @@ -75,6 +75,7 @@ function ConnectCtl($scope, StropheSrv, $log, $rootScope) { $scope.generate_key = function() { var rsa_key = new RSAKey(); rsa_key.generate(1024, "10001"); + $rootScope.alias.rsa_key = rsa_key; var pubkey = { n: rsa_key.n.toString(16), e: rsa_key.e.toString(16) @@ -92,17 +93,17 @@ function ConnectCtl($scope, StropheSrv, $log, $rootScope) { $("#form-privkey","#register").val(privkey); }; - function send_registration() { + $scope.send_registration = function() { var pubkey = $('