Commit ca552f34 authored by JC Brand's avatar JC Brand

Bugfix. Don't save the session if we aren't authenticated.

Also, fixed reg form cancelation.
parent d33f129d
...@@ -508,7 +508,7 @@ ...@@ -508,7 +508,7 @@
this.session.browserStorage = new Backbone.BrowserStorage[converse.storage](id); this.session.browserStorage = new Backbone.BrowserStorage[converse.storage](id);
this.session.fetch(); this.session.fetch();
$(window).on('beforeunload', $.proxy(function () { $(window).on('beforeunload', $.proxy(function () {
if (converse.connection.connected) { if (converse.connection.authenticated) {
this.setSession(); this.setSession();
} else { } else {
this.clearSession(); this.clearSession();
...@@ -4671,8 +4671,8 @@ ...@@ -4671,8 +4671,8 @@
}); });
$form.append('<input type="submit" class="submit" value="'+__('Register')+'"/>'); $form.append('<input type="submit" class="submit" value="'+__('Register')+'"/>');
$form.append('<input type="button" class="submit" value="'+__('Cancel')+'"/>'); $form.append('<input type="button" class="submit" value="'+__('Cancel')+'"/>');
$form.on('submit', $.proxy(this.onRegister, this)); $form.on('submit', $.proxy(this.submitRegistrationForm, this));
$form.find('input[type=button]').on('click', $.proxy(this.onCancel, this)); $form.find('input[type=button]').on('click', $.proxy(this.cancelRegistration, this));
}, },
reportErrors: function (stanza) { reportErrors: function (stanza) {
...@@ -4708,17 +4708,15 @@ ...@@ -4708,17 +4708,15 @@
$flash.show(); $flash.show();
}, },
cancel: function (ev) { cancelRegistration: function (ev) {
/* Callback method, when the user cancels the registration /* Handler, when the user cancels the registration form.
* form.
*/ */
if (ev && ev.preventDefault) { ev.preventDefault(); } if (ev && ev.preventDefault) { ev.preventDefault(); }
this.render(); // XXX: check if this works. this.render(); // XXX: check if this works.
}, },
onRegister: function (ev) { submitRegistrationForm : function (ev) {
/* Callback method, when the user submits the registration /* Handler, when the user submits the registration form.
* form.
* Provides form error feedback or starts the registration * Provides form error feedback or starts the registration
* process. * process.
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment