Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
This commit is contained in:
commit
a2fd32d6a3
@ -1125,6 +1125,7 @@ define(function () {
|
|||||||
out.properties_changePassword = "Modifier le mot de passe";
|
out.properties_changePassword = "Modifier le mot de passe";
|
||||||
out.properties_confirmNew = "Êtes-vous sûr ? Ajouter un mot de passe changera l'URL de ce pad et supprimera son historique. Les utilisateurs ne connaissant pas le nouveau mot de passe perdront l'accès au pad.";
|
out.properties_confirmNew = "Êtes-vous sûr ? Ajouter un mot de passe changera l'URL de ce pad et supprimera son historique. Les utilisateurs ne connaissant pas le nouveau mot de passe perdront l'accès au pad.";
|
||||||
out.properties_confirmChange = "Êtes-vous sûr ? Changer le mot de passe supprimera l'historique de ce pad. Les utilisateurs ne connaissant pas le nouveau mot de passe perdront l'accès au pad.";
|
out.properties_confirmChange = "Êtes-vous sûr ? Changer le mot de passe supprimera l'historique de ce pad. Les utilisateurs ne connaissant pas le nouveau mot de passe perdront l'accès au pad.";
|
||||||
|
out.properties_passwordSame = "Le nouveau mot de passe doit être différent de celui existant.";
|
||||||
out.properties_passwordError = "Une erreur est survenue lors de la modification du mot de passe. Veuillez réessayer.";
|
out.properties_passwordError = "Une erreur est survenue lors de la modification du mot de passe. Veuillez réessayer.";
|
||||||
out.properties_passwordWarning = "Le mot de passe a été modifié avec succès mais nous n'avons pas réussi à mettre à jour votre CryptDrive avec les nouvelles informations. Vous devrez peut-être supprimer manuellement l'ancienne version de ce pad.<br>Appuyez sur OK pour recharger le pad et mettre à jour vos droits d'accès.";
|
out.properties_passwordWarning = "Le mot de passe a été modifié avec succès mais nous n'avons pas réussi à mettre à jour votre CryptDrive avec les nouvelles informations. Vous devrez peut-être supprimer manuellement l'ancienne version de ce pad.<br>Appuyez sur OK pour recharger le pad et mettre à jour vos droits d'accès.";
|
||||||
out.properties_passwordSuccess = "Le mot de passe a été modifié avec succès.<br>Appuyez sur OK pour mettre à jour vos droits d'accès.";
|
out.properties_passwordSuccess = "Le mot de passe a été modifié avec succès.<br>Appuyez sur OK pour mettre à jour vos droits d'accès.";
|
||||||
|
|||||||
@ -1183,6 +1183,7 @@ define(function () {
|
|||||||
out.properties_changePassword = "Change the password";
|
out.properties_changePassword = "Change the password";
|
||||||
out.properties_confirmNew = "Are you sure? Adding a password will change this pad's URL and remove its history. Users without the password will lose access to this pad";
|
out.properties_confirmNew = "Are you sure? Adding a password will change this pad's URL and remove its history. Users without the password will lose access to this pad";
|
||||||
out.properties_confirmChange = "Are you sure? Changing the password will remove its history. Users without the new password will lose access to this pad";
|
out.properties_confirmChange = "Are you sure? Changing the password will remove its history. Users without the new password will lose access to this pad";
|
||||||
|
out.properties.passwordSame = "New passwords must differ from the current one.";
|
||||||
out.properties_passwordError = "An error occured while trying to change the password. Please try again.";
|
out.properties_passwordError = "An error occured while trying to change the password. Please try again.";
|
||||||
out.properties_passwordWarning = "The password was successfully changed but we were unable to update your CryptDrive with the new data. You may have to remove the old version of the pad manually.<br>Press OK to reload and update your acces rights.";
|
out.properties_passwordWarning = "The password was successfully changed but we were unable to update your CryptDrive with the new data. You may have to remove the old version of the pad manually.<br>Press OK to reload and update your acces rights.";
|
||||||
out.properties_passwordSuccess = "The password was successfully changed.<br>Press OK to reload and update your access rights.";
|
out.properties_passwordSuccess = "The password was successfully changed.<br>Press OK to reload and update your access rights.";
|
||||||
|
|||||||
@ -147,7 +147,7 @@ define([
|
|||||||
id: 'cp-app-prop-expire',
|
id: 'cp-app-prop-expire',
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var hasPassword = typeof data.password !== "undefined";
|
var hasPassword = data.password;
|
||||||
if (hasPassword) {
|
if (hasPassword) {
|
||||||
$('<label>', {'for': 'cp-app-prop-password'}).text(Messages.creation_passwordValue)
|
$('<label>', {'for': 'cp-app-prop-password'}).text(Messages.creation_passwordValue)
|
||||||
.appendTo($d);
|
.appendTo($d);
|
||||||
@ -183,23 +183,31 @@ define([
|
|||||||
passwordOk
|
passwordOk
|
||||||
]);
|
]);
|
||||||
$(passwordOk).click(function () {
|
$(passwordOk).click(function () {
|
||||||
|
var newPass = $(newPassword).find('input').val();
|
||||||
|
if (data.password === newPass ||
|
||||||
|
(!data.password && !newPass)) {
|
||||||
|
return void UI.alert(Messages.properties_passwordSame);
|
||||||
|
}
|
||||||
UI.confirm(changePwConfirm, function (yes) {
|
UI.confirm(changePwConfirm, function (yes) {
|
||||||
if (!yes) { return; }
|
if (!yes) { return; }
|
||||||
sframeChan.query("Q_PAD_PASSWORD_CHANGE", {
|
sframeChan.query("Q_PAD_PASSWORD_CHANGE", {
|
||||||
href: data.href,
|
href: data.href,
|
||||||
password: $(newPassword).find('input').val()
|
password: newPass
|
||||||
}, function (err, data) {
|
}, function (err, data) {
|
||||||
if (err || data.error) {
|
if (err || data.error) {
|
||||||
return void UI.alert(Messages.properties_passwordError);
|
return void UI.alert(Messages.properties_passwordError);
|
||||||
}
|
}
|
||||||
UI.findOKButton().click();
|
UI.findOKButton().click();
|
||||||
|
// If we didn't have a password, we have to add the /p/
|
||||||
|
// If we had a password and we changed it to a new one, we just have to reload
|
||||||
|
// If we had a password and we removed it, we have to remove the /p/
|
||||||
if (data.warning) {
|
if (data.warning) {
|
||||||
return void UI.alert(Messages.properties_passwordWarning, function () {
|
return void UI.alert(Messages.properties_passwordWarning, function () {
|
||||||
common.gotoURL(hasPassword ? undefined : data.href);
|
common.gotoURL(hasPassword && newPass ? undefined : data.href);
|
||||||
}, {force: true});
|
}, {force: true});
|
||||||
}
|
}
|
||||||
return void UI.alert(Messages.properties_passwordSuccess, function () {
|
return void UI.alert(Messages.properties_passwordSuccess, function () {
|
||||||
common.gotoURL(hasPassword ? undefined : data.href);
|
common.gotoURL(hasPassword && newPass ? undefined : data.href);
|
||||||
}, {force: true});
|
}, {force: true});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -622,10 +622,17 @@ define([
|
|||||||
var warning = false;
|
var warning = false;
|
||||||
var newHash;
|
var newHash;
|
||||||
var oldChannel;
|
var oldChannel;
|
||||||
if (parsed.hashData.password) {
|
var newSecret;
|
||||||
newHash = parsed.hash;
|
|
||||||
|
if (parsed.hashData.version >= 2) {
|
||||||
|
newSecret = Hash.getSecrets(parsed.type, parsed.hash, newPassword);
|
||||||
|
if (!(newSecret.keys && newSecret.keys.editKeyStr)) {
|
||||||
|
return void cb({error: 'EAUTH'});
|
||||||
|
}
|
||||||
|
newHash = Hash.getEditHashFromKeys(newSecret);
|
||||||
} else {
|
} else {
|
||||||
newHash = Hash.createRandomHash(parsed.type, newPassword);
|
newHash = Hash.createRandomHash(parsed.type, newPassword);
|
||||||
|
newSecret = Hash.getSecrets(parsed.type, newHash, newPassword);
|
||||||
}
|
}
|
||||||
var newHref = '/' + parsed.type + '/#' + newHash;
|
var newHref = '/' + parsed.type + '/#' + newHash;
|
||||||
|
|
||||||
@ -677,16 +684,17 @@ define([
|
|||||||
return void cb(obj);
|
return void cb(obj);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
common.unpinPads([oldChannel], waitFor());
|
||||||
|
common.pinPads([newSecret.channel], waitFor());
|
||||||
}).nThen(function (waitFor) {
|
}).nThen(function (waitFor) {
|
||||||
common.setPadAttribute('password', newPassword, waitFor(function (err) {
|
common.setPadAttribute('password', newPassword, waitFor(function (err) {
|
||||||
if (err) { warning = true; }
|
if (err) { warning = true; }
|
||||||
}), href);
|
}), href);
|
||||||
var secret = Hash.getSecrets(parsed.type, newHash, newPassword);
|
common.setPadAttribute('channel', newSecret.channel, waitFor(function (err) {
|
||||||
common.setPadAttribute('channel', secret.channel, waitFor(function (err) {
|
|
||||||
if (err) { warning = true; }
|
if (err) { warning = true; }
|
||||||
}), href);
|
}), href);
|
||||||
|
|
||||||
if (parsed.hashData.password) { return; } // same hash
|
if (parsed.hashData.password && newPassword) { return; } // same hash
|
||||||
common.setPadAttribute('href', newHref, waitFor(function (err) {
|
common.setPadAttribute('href', newHref, waitFor(function (err) {
|
||||||
if (err) { warning = true; }
|
if (err) { warning = true; }
|
||||||
}), href);
|
}), href);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user