From 1a855dc54caa5ef70149718a69f7bfdc14f79469 Mon Sep 17 00:00:00 2001 From: Zaran Date: Sun, 6 May 2012 18:51:04 -0700 Subject: More work on the registration --- alias-angular/app/css/app.less | 4 + alias-angular/app/index.html | 21 +- alias-angular/app/js/controllers.js | 10 +- alias-angular/app/lib/bootstrap-modal.js | 218 ++++++++++ alias-angular/app/lib/jquery.forms.js | 73 ++++ alias-angular/app/lib/jsbn.js | 559 ++++++++++++++++++++++++++ alias-angular/app/lib/jsbn2.js | 656 +++++++++++++++++++++++++++++++ alias-angular/app/lib/prng4.js | 45 +++ alias-angular/app/lib/rng.js | 68 ++++ alias-angular/app/lib/rsa.js | 112 ++++++ alias-angular/app/lib/rsa2.js | 132 +++++++ 11 files changed, 1892 insertions(+), 6 deletions(-) create mode 100644 alias-angular/app/lib/bootstrap-modal.js create mode 100644 alias-angular/app/lib/jquery.forms.js create mode 100644 alias-angular/app/lib/jsbn.js create mode 100644 alias-angular/app/lib/jsbn2.js create mode 100644 alias-angular/app/lib/prng4.js create mode 100644 alias-angular/app/lib/rng.js create mode 100644 alias-angular/app/lib/rsa.js create mode 100644 alias-angular/app/lib/rsa2.js (limited to 'alias-angular/app') diff --git a/alias-angular/app/css/app.less b/alias-angular/app/css/app.less index e66177a..73bc77b 100644 --- a/alias-angular/app/css/app.less +++ b/alias-angular/app/css/app.less @@ -104,3 +104,7 @@ ul.chat-area{ } } } + +#register{ + display:none; +} diff --git a/alias-angular/app/index.html b/alias-angular/app/index.html index 06f94e2..5437815 100644 --- a/alias-angular/app/index.html +++ b/alias-angular/app/index.html @@ -11,6 +11,17 @@
+
@@ -26,7 +37,7 @@
+ + @@ -81,5 +94,11 @@ + + + + + diff --git a/alias-angular/app/js/controllers.js b/alias-angular/app/js/controllers.js index 732fcd3..1fca239 100644 --- a/alias-angular/app/js/controllers.js +++ b/alias-angular/app/js/controllers.js @@ -2,6 +2,7 @@ /* App Controllers */ function ConnectCtl($scope, StropheSrv, $log, $rootScope) { + $rootScope.alias = {jid: "", status: 'offline' }; @@ -66,13 +67,12 @@ function ConnectCtl($scope, StropheSrv, $log, $rootScope) { privkey.dq, privkey.c); $rootScope.alias.rsa_key = rsa_key; }else{ - $scope.instructions = $(iq).find('instructions'); - $scope.form = form.xmppForm('render'); + $("#register .modal-body").append(form.xmppForm('render')); $("#register").modal("show"); } }; - function generate_key() { + $scope.generate_key = function() { var rsa_key = new RSAKey(); rsa_key.generate(1024, "10001"); var pubkey = { @@ -88,8 +88,8 @@ function ConnectCtl($scope, StropheSrv, $log, $rootScope) { c: rsa_key.coeff.toString(16) }; privkey = sjcl.encrypt($scope.password, JSON.stringify(privkey)); - $("#form-pubkey").val(JSON.stringify(pubkey)); - $("#form-privkey").val(privkey); + $("#form-pubkey","#register").val(JSON.stringify(pubkey)); + $("#form-privkey","#register").val(privkey); }; function send_registration() { diff --git a/alias-angular/app/lib/bootstrap-modal.js b/alias-angular/app/lib/bootstrap-modal.js new file mode 100644 index 0000000..c831de6 --- /dev/null +++ b/alias-angular/app/lib/bootstrap-modal.js @@ -0,0 +1,218 @@ +/* ========================================================= + * bootstrap-modal.js v2.0.3 + * http://twitter.github.com/bootstrap/javascript.html#modals + * ========================================================= + * Copyright 2012 Twitter, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================= */ + + +!function ($) { + + "use strict"; // jshint ;_; + + + /* MODAL CLASS DEFINITION + * ====================== */ + + var Modal = function (content, options) { + this.options = options + this.$element = $(content) + .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) + } + + Modal.prototype = { + + constructor: Modal + + , toggle: function () { + return this[!this.isShown ? 'show' : 'hide']() + } + + , show: function () { + var that = this + , e = $.Event('show') + + this.$element.trigger(e) + + if (this.isShown || e.isDefaultPrevented()) return + + $('body').addClass('modal-open') + + this.isShown = true + + escape.call(this) + backdrop.call(this, function () { + var transition = $.support.transition && that.$element.hasClass('fade') + + if (!that.$element.parent().length) { + that.$element.appendTo(document.body) //don't move modals dom position + } + + that.$element + .show() + + if (transition) { + that.$element[0].offsetWidth // force reflow + } + + that.$element.addClass('in') + + transition ? + that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) : + that.$element.trigger('shown') + + }) + } + + , hide: function (e) { + e && e.preventDefault() + + var that = this + + e = $.Event('hide') + + this.$element.trigger(e) + + if (!this.isShown || e.isDefaultPrevented()) return + + this.isShown = false + + $('body').removeClass('modal-open') + + escape.call(this) + + this.$element.removeClass('in') + + $.support.transition && this.$element.hasClass('fade') ? + hideWithTransition.call(this) : + hideModal.call(this) + } + + } + + + /* MODAL PRIVATE METHODS + * ===================== */ + + function hideWithTransition() { + var that = this + , timeout = setTimeout(function () { + that.$element.off($.support.transition.end) + hideModal.call(that) + }, 500) + + this.$element.one($.support.transition.end, function () { + clearTimeout(timeout) + hideModal.call(that) + }) + } + + function hideModal(that) { + this.$element + .hide() + .trigger('hidden') + + backdrop.call(this) + } + + function backdrop(callback) { + var that = this + , animate = this.$element.hasClass('fade') ? 'fade' : '' + + if (this.isShown && this.options.backdrop) { + var doAnimate = $.support.transition && animate + + this.$backdrop = $('