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

This commit is contained in:
yflory
2017-09-12 11:29:57 +02:00
5 changed files with 36 additions and 7 deletions

View File

@@ -571,6 +571,14 @@ define([
cpNfInner = common.startRealtime(config); cpNfInner = common.startRealtime(config);
metadataMgr = cpNfInner.metadataMgr; metadataMgr = cpNfInner.metadataMgr;
cpNfInner.onInfiniteSpinner(function () {
setEditable(false);
Cryptpad.confirm(Messages.realtime_unrecoverableError, function (yes) {
if (!yes) { return; }
common.gotoURL();
});
});
editor.on('change', onLocal); editor.on('change', onLocal);
Cryptpad.onLogout(function () { setEditable(false); }); Cryptpad.onLogout(function () { setEditable(false); });

View File

@@ -36,8 +36,9 @@ define([
return $('button.ok').last(); return $('button.ok').last();
}; };
var listenForKeys = UI.listenForKeys = function (yes, no) { var listenForKeys = UI.listenForKeys = function (yes, no, el) {
var handler = function (e) { var handler = function (e) {
e.stopPropagation();
switch (e.which) { switch (e.which) {
case 27: // cancel case 27: // cancel
if (typeof(no) === 'function') { no(e); } if (typeof(no) === 'function') { no(e); }
@@ -48,7 +49,7 @@ define([
} }
}; };
$(window).keyup(handler); $(el || window).keydown(handler);
return handler; return handler;
}; };
@@ -114,7 +115,9 @@ define([
}; };
dialog.frame = function (content) { dialog.frame = function (content) {
return h('div.alertify', [ return h('div.alertify', {
tabindex: 1,
}, [
h('div.dialog', [ h('div.dialog', [
h('div', content), h('div', content),
]) ])
@@ -229,6 +232,7 @@ define([
var close = Util.once(function () { var close = Util.once(function () {
$(frame).fadeOut(150, function () { $(this).remove(); }); $(frame).fadeOut(150, function () { $(this).remove(); });
stopListening(listener); stopListening(listener);
cb();
}); });
listener = listenForKeys(close, close); listener = listenForKeys(close, close);
var $ok = $(ok).click(close); var $ok = $(ok).click(close);
@@ -237,7 +241,6 @@ define([
setTimeout(function () { setTimeout(function () {
$ok.focus(); $ok.focus();
UI.notify(); UI.notify();
if (!document.hasFocus()) { window.focus(); }
}); });
}; };
@@ -283,7 +286,6 @@ define([
setTimeout(function () { setTimeout(function () {
input.select().focus(); input.select().focus();
UI.notify(); UI.notify();
if (!document.hasFocus()) { window.focus(); }
}); });
}; };
@@ -330,10 +332,10 @@ define([
document.body.appendChild(frame); document.body.appendChild(frame);
setTimeout(function () { setTimeout(function () {
UI.notify(); UI.notify();
$(frame).find('.ok').focus();
if (typeof(opt.done) === 'function') { if (typeof(opt.done) === 'function') {
opt.done($ok.closest('.dialog')); opt.done($ok.closest('.dialog'));
} }
if (!document.hasFocus()) { window.focus(); }
}); });
}; };

View File

@@ -657,7 +657,9 @@ define([
var fData = files[FILES_DATA]; var fData = files[FILES_DATA];
getFiles([FILES_DATA]).forEach(function (id) { getFiles([FILES_DATA]).forEach(function (id) {
if (filesList.indexOf(id) === -1) { if (filesList.indexOf(id) === -1) {
removePadAttribute(fData[id].href); if (fData[id] && fData[id].href) {
removePadAttribute(fData[id].href);
}
spliceFileData(id); spliceFileData(id);
} }
}); });

View File

@@ -115,6 +115,15 @@ define([
var doesAccept = $checkAcceptTerms[0].checked; var doesAccept = $checkAcceptTerms[0].checked;
/* basic validation */ /* basic validation */
if (!Cred.isLongEnoughPassword(passwd)) {
var warning = Messages._getKey('register_passwordTooShort', [
Cred.MINIMUM_PASSWORD_LENGTH
]);
return void Cryptpad.alert(warning, function () {
registering = false;
});
}
if (passwd !== confirmPassword) { // do their passwords match? if (passwd !== confirmPassword) { // do their passwords match?
return void Cryptpad.alert(Messages.register_passwordsDontMatch); return void Cryptpad.alert(Messages.register_passwordsDontMatch);
} }

View File

@@ -682,6 +682,14 @@ define([
cpNfInner = common.startRealtime(config); cpNfInner = common.startRealtime(config);
metadataMgr = cpNfInner.metadataMgr; metadataMgr = cpNfInner.metadataMgr;
cpNfInner.onInfiniteSpinner(function () {
setEditable(false);
Cryptpad.confirm(Messages.realtime_unrecoverableError, function (yes) {
if (!yes) { return; }
common.gotoURL();
});
});
editor.on('change', onLocal); editor.on('change', onLocal);
Cryptpad.onLogout(function () { setEditable(false); }); Cryptpad.onLogout(function () { setEditable(false); });