Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
yflory 8 years ago
commit a38819f5b9

@ -63,6 +63,7 @@ types of messages:
// RPC responses are arrays. this message isn't meant for us. // RPC responses are arrays. this message isn't meant for us.
return; return;
} }
if (/FULL_HISTORY/.test(parsed[0])) { return; }
var response = parsed.slice(2); var response = parsed.slice(2);
@ -98,7 +99,7 @@ types of messages:
delete ctx.pending[txid]; delete ctx.pending[txid];
return; return;
} }
console.error("received message for txid[%s] with no callback", txid); console.error("received message [%s] for txid[%s] with no callback", msg, txid);
}; };
var create = function (network, edPrivateKey, edPublicKey, cb) { var create = function (network, edPrivateKey, edPublicKey, cb) {

@ -63,6 +63,7 @@ define([
var $register = $('button#register'); var $register = $('button#register');
var registering = false;
var logMeIn = function (result) { var logMeIn = function (result) {
if (Test.testing) { if (Test.testing) {
Test.passed(); Test.passed();
@ -79,6 +80,7 @@ define([
Cryptpad.whenRealtimeSyncs(result.realtime, function () { Cryptpad.whenRealtimeSyncs(result.realtime, function () {
Cryptpad.login(result.userHash, result.userName, function () { Cryptpad.login(result.userHash, result.userName, function () {
registering = false;
if (sessionStorage.redirectTo) { if (sessionStorage.redirectTo) {
var h = sessionStorage.redirectTo; var h = sessionStorage.redirectTo;
var parser = document.createElement('a'); var parser = document.createElement('a');
@ -95,6 +97,11 @@ define([
}; };
$register.click(function () { $register.click(function () {
if (registering) {
console.log("registration is already in progress");
return;
}
var uname = $uname.val(); var uname = $uname.val();
var passwd = $passwd.val(); var passwd = $passwd.val();
var confirmPassword = $confirm.val(); var confirmPassword = $confirm.val();
@ -115,6 +122,7 @@ define([
function (yes) { function (yes) {
if (!yes) { return; } if (!yes) { return; }
registering = true;
// setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up // setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up
window.setTimeout(function () { window.setTimeout(function () {
Cryptpad.addLoadingScreen(Messages.login_hashing); Cryptpad.addLoadingScreen(Messages.login_hashing);
@ -127,20 +135,27 @@ define([
switch (err) { switch (err) {
case 'NO_SUCH_USER': case 'NO_SUCH_USER':
Cryptpad.removeLoadingScreen(function () { Cryptpad.removeLoadingScreen(function () {
Cryptpad.alert(Messages.login_noSuchUser); Cryptpad.alert(Messages.login_noSuchUser, function () {
registering = false;
});
}); });
break; break;
case 'INVAL_USER': case 'INVAL_USER':
Cryptpad.removeLoadingScreen(function () { Cryptpad.removeLoadingScreen(function () {
Cryptpad.alert(Messages.login_invalUser); Cryptpad.alert(Messages.login_invalUser, function () {
registering = false;
});
}); });
break; break;
case 'INVAL_PASS': case 'INVAL_PASS':
Cryptpad.removeLoadingScreen(function () { Cryptpad.removeLoadingScreen(function () {
Cryptpad.alert(Messages.login_invalPass); Cryptpad.alert(Messages.login_invalPass, function () {
registering = false;
});
}); });
break; break;
case 'ALREADY_REGISTERED': case 'ALREADY_REGISTERED':
// logMeIn should reset registering = false
Cryptpad.removeLoadingScreen(function () { Cryptpad.removeLoadingScreen(function () {
Cryptpad.confirm(Messages.register_alreadyRegistered, function (yes) { Cryptpad.confirm(Messages.register_alreadyRegistered, function (yes) {
if (!yes) { return; } if (!yes) { return; }
@ -155,6 +170,7 @@ define([
}); });
break; break;
default: // UNHANDLED ERROR default: // UNHANDLED ERROR
registering = false;
Cryptpad.errorLoadingScreen(Messages.login_unhandledError); Cryptpad.errorLoadingScreen(Messages.login_unhandledError);
} }
return; return;

@ -144,7 +144,7 @@ define([
updateFontSize(); updateFontSize();
}; };
Slide.update = function (content, init) { Slide.update = function (content) {
updateFontSize(); updateFontSize();
//if (!init) { return; } //if (!init) { return; }
if (!content) { content = ''; } if (!content) { content = ''; }

Loading…
Cancel
Save