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

This commit is contained in:
yflory 2018-07-19 11:43:06 +02:00
commit 1e092f36ba
6 changed files with 22 additions and 14 deletions

View file

@ -608,6 +608,7 @@ define(function () {
out.settings_changePasswordNewConfirm = "Confirmer le nouveau mot de passe";
out.settings_changePasswordConfirm = "Êtes-vous sûr de vouloir changer votre mot de passe ? Vous devrez vous reconnecter sur tous vos appareils.";
out.settings_changePasswordError = "Une erreur est survenue. Si vous n'êtes plus en mesure de vous connecter à votre compte utilisateur ou de changer votre mot de passe, veuillez contacter l'administrateur de votre CryptPad.";
out.settings_changePasswordPending = "Votre mot de passe est en train d'être modifié. Veuillez ne pas fermer ou recharger cette page avant que le traitement soit terminé.";
out.upload_title = "Hébergement de fichiers";
out.upload_modal_title = "Options d'importation du fichier";

View file

@ -617,6 +617,7 @@ define(function () {
out.settings_changePasswordNewConfirm = "Confirm new password";
out.settings_changePasswordConfirm = "Are you sure you want to change your password? You will need to log back in on all your devices.";
out.settings_changePasswordError = "An unexpected error occurred. If you are unable to login or change your password, contact your CryptPad administrators.";
out.settings_changePasswordPending = "Your password is being updated. Please do not close or reload this page until the process has completed.";
out.upload_title = "File upload";
out.upload_modal_title = "File upload options";

View file

@ -10,7 +10,7 @@
"dependencies": {
"chainpad-server": "~2.1.0",
"express": "~4.16.0",
"mkdirp": "^0.5.1",
"fs-extra": "^7.0.0",
"nthen": "~0.1.0",
"pull-stream": "^3.6.1",
"replify": "^1.2.0",

15
rpc.js
View file

@ -7,13 +7,14 @@ var Nacl = require("tweetnacl");
/* globals process */
var Fs = require("fs");
var Fse = require("fs-extra");
var Path = require("path");
var Https = require("https");
const Package = require('./package.json');
const Pinned = require('./pinned');
const Saferphore = require("saferphore");
const nThen = require("nthen");
const Mkdirp = require("mkdirp");
var RPC = module.exports;
@ -1054,7 +1055,7 @@ var upload_complete = function (Env, publicKey, id, cb) {
}
// lol wut handle ur errors
Fs.rename(oldPath, newPath, function (e) {
Fse.move(oldPath, newPath, function (e) {
if (e) {
WARN('rename', e);
return void cb('RENAME_ERR');
@ -1146,7 +1147,7 @@ var owned_upload_complete = function (Env, safeKey, cb) {
// flow is dumb and I need to guard against this which will never happen
// / *:: if (typeof(oldPath) === 'object') { throw new Error('should never happen'); } * /
Fs.rename(oldPath, finalPath, w(function (e) {
Fs.move(oldPath, finalPath, w(function (e) {
if (e) {
w.abort();
return void cb(e.code);
@ -1218,13 +1219,13 @@ var owned_upload_complete = function (Env, safeKey, id, cb) {
var finalOwnPath;
nThen(function (w) {
// make the requisite directory structure using Mkdirp
Mkdirp(filePath, w(function (e /*, path */) {
Fse.mkdirp(filePath, w(function (e /*, path */) {
if (e) { // does not throw error if the directory already existed
w.abort();
return void cb(e.code);
}
}));
Mkdirp(ownPath, w(function (e /*, path */) {
Fse.mkdirp(ownPath, w(function (e /*, path */) {
if (e) { // does not throw error if the directory already existed
w.abort();
return void cb(e.code);
@ -1254,7 +1255,7 @@ var owned_upload_complete = function (Env, safeKey, id, cb) {
// flow is dumb and I need to guard against this which will never happen
/*:: if (typeof(oldPath) === 'object') { throw new Error('should never happen'); } */
Fs.rename(oldPath, finalPath, w(function (e) {
Fse.move(oldPath, finalPath, w(function (e) {
if (e) {
// Remove the ownership file
Fs.unlink(finalOwnPath, function (e) {
@ -1398,7 +1399,7 @@ var writeLoginBlock = function (Env, msg, cb) {
nThen(function (w) {
// make sure the path to the file exists
Mkdirp(parsed.dir, w(function (e) {
Fse.mkdirp(parsed.dir, w(function (e) {
if (e) {
w.abort();
cb(e);

View file

@ -8,7 +8,7 @@ define([
'/bower_components/nthen/index.js'
], function (Config, nThen) { /*::});module.exports = (function() {
const Config = (undefined:any);
const nThen = require('/bower_components/nthen/index.js');
const nThen = (undefined:any);
*/
var module = { exports: {} };
@ -141,17 +141,16 @@ define([
var loadSubmodulesAndInject = function (css, url, cb, stack) {
inject(css, url);
var nt = nThen;
nt = nt(function (w) {
nThen(function (w) {
css.replace(/\-\-LessLoader_require\:\s*"([^"]*)"\s*;/g, function (all, u) {
u = u.replace(/\?.*$/, '');
module.exports.load(u, w(), stack);
return '';
});
}).nThen;
nt(function () { cb(); });
}).nThen(function () { cb(); });
};
module.exports.load = function (url /*:string*/, cb /*:()=>void*/, stack /*:?Array*/) {
module.exports.load = function (url /*:string*/, cb /*:()=>void*/, stack /*:?Array<string>*/) {
var btime = stack ? null : +new Date();
stack = stack || [];
if (stack.indexOf(url) > -1) { return void cb(); }

View file

@ -431,10 +431,16 @@ define([
UI.confirm(Messages.settings_changePasswordConfirm,
function (yes) {
if (!yes) { return; }
UI.addLoadingScreen({
hideTips: true,
loadingText: Messages.settings_changePasswordPending,
});
updateBlock({
password: oldPassword,
newPassword: newPassword
}, function (obj) {
UI.removeLoadingScreen();
if (obj && obj.error) {
// TODO
UI.alert(Messages.settings_changePasswordError);