Merge branch 'staging' of github.com:xwiki-labs/cryptpad into keywords
This commit is contained in:
@@ -6,10 +6,17 @@ define([
|
||||
'/common/outer/network-config.js',
|
||||
'/customize/credential.js',
|
||||
'/bower_components/chainpad/chainpad.dist.js',
|
||||
'/common/common-realtime.js',
|
||||
'/common/common-constants.js',
|
||||
'/common/common-interface.js',
|
||||
'/common/common-feedback.js',
|
||||
'/common/outer/local-store.js',
|
||||
'/customize/messages.js',
|
||||
|
||||
'/bower_components/tweetnacl/nacl-fast.min.js',
|
||||
'/bower_components/scrypt-async/scrypt-async.min.js', // better load speed
|
||||
], function ($, Listmap, Crypto, Util, NetConfig, Cred, ChainPad) {
|
||||
], function ($, Listmap, Crypto, Util, NetConfig, Cred, ChainPad, Realtime, Constants, UI,
|
||||
Feedback, LocalStore, Messages) {
|
||||
var Exports = {
|
||||
Cred: Cred,
|
||||
};
|
||||
@@ -142,5 +149,127 @@ define([
|
||||
});
|
||||
};
|
||||
|
||||
Exports.loginOrRegisterUI = function (uname, passwd, isRegister, shouldImport, testing, test) {
|
||||
var hashing = true;
|
||||
|
||||
var proceed = function (result) {
|
||||
var proxy = result.proxy;
|
||||
proxy.edPublic = result.edPublic;
|
||||
proxy.edPrivate = result.edPrivate;
|
||||
proxy.curvePublic = result.curvePublic;
|
||||
proxy.curvePrivate = result.curvePrivate;
|
||||
|
||||
if (isRegister) {
|
||||
Feedback.send('REGISTRATION', true);
|
||||
} else {
|
||||
Feedback.send('LOGIN', true);
|
||||
}
|
||||
|
||||
Realtime.whenRealtimeSyncs(result.realtime, function () {
|
||||
try {
|
||||
LocalStore.login(result.userHash, result.userName, function () {
|
||||
hashing = false;
|
||||
if (test && typeof test === "function" && test()) { console.log('testing');
|
||||
return; }
|
||||
if (shouldImport) {
|
||||
sessionStorage.migrateAnonDrive = 1;
|
||||
}
|
||||
if (sessionStorage.redirectTo) {
|
||||
var h = sessionStorage.redirectTo;
|
||||
var parser = document.createElement('a');
|
||||
parser.href = h;
|
||||
if (parser.origin === window.location.origin) {
|
||||
delete sessionStorage.redirectTo;
|
||||
window.location.href = h;
|
||||
return;
|
||||
}
|
||||
}
|
||||
window.location.href = '/drive/';
|
||||
});
|
||||
} catch (e) { console.error(e); }
|
||||
});
|
||||
};
|
||||
|
||||
// setTimeout 100ms to remove the keyboard on mobile devices before the loading screen
|
||||
// pops up
|
||||
window.setTimeout(function () {
|
||||
UI.addLoadingScreen({
|
||||
loadingText: Messages.login_hashing,
|
||||
hideTips: true,
|
||||
});
|
||||
// We need a setTimeout(cb, 0) otherwise the loading screen is only displayed
|
||||
// after hashing the password
|
||||
window.setTimeout(function () {
|
||||
Exports.loginOrRegister(uname, passwd, isRegister, function (err, result) {
|
||||
var proxy;
|
||||
if (result) { proxy = result.proxy; }
|
||||
|
||||
if (err) {
|
||||
switch (err) {
|
||||
case 'NO_SUCH_USER':
|
||||
UI.removeLoadingScreen(function () {
|
||||
UI.alert(Messages.login_noSuchUser, function () {
|
||||
hashing = false;
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'INVAL_USER':
|
||||
UI.removeLoadingScreen(function () {
|
||||
UI.alert(Messages.login_invalUser, function () {
|
||||
hashing = false;
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'INVAL_PASS':
|
||||
UI.removeLoadingScreen(function () {
|
||||
UI.alert(Messages.login_invalPass, function () {
|
||||
hashing = false;
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'PASS_TOO_SHORT':
|
||||
UI.removeLoadingScreen(function () {
|
||||
var warning = Messages._getKey('register_passwordTooShort', [
|
||||
Cred.MINIMUM_PASSWORD_LENGTH
|
||||
]);
|
||||
UI.alert(warning, function () {
|
||||
hashing = false;
|
||||
});
|
||||
});
|
||||
break;
|
||||
case 'ALREADY_REGISTERED':
|
||||
// logMeIn should reset registering = false
|
||||
UI.removeLoadingScreen(function () {
|
||||
UI.confirm(Messages.register_alreadyRegistered, function (yes) {
|
||||
if (!yes) { return; }
|
||||
proxy.login_name = uname;
|
||||
|
||||
if (!proxy[Constants.displayNameKey]) {
|
||||
proxy[Constants.displayNameKey] = uname;
|
||||
}
|
||||
LocalStore.eraseTempSessionValues();
|
||||
proceed(result);
|
||||
});
|
||||
});
|
||||
break;
|
||||
default: // UNHANDLED ERROR
|
||||
hashing = false;
|
||||
UI.errorLoadingScreen(Messages.login_unhandledError);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (testing) { return void proceed(result); }
|
||||
|
||||
proxy.login_name = uname;
|
||||
proxy[Constants.displayNameKey] = uname;
|
||||
sessionStorage.createReadme = 1;
|
||||
|
||||
proceed(result);
|
||||
});
|
||||
}, 0);
|
||||
}, 200);
|
||||
};
|
||||
|
||||
return Exports;
|
||||
});
|
||||
|
||||
@@ -33,16 +33,26 @@
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
h2, p {
|
||||
width: 100%;
|
||||
}
|
||||
h2 {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
margin-bottom: 20px;
|
||||
justify-content: space-between;
|
||||
.cp-creation-help {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.cp-creation-help-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
p {
|
||||
padding: 0 20px;
|
||||
flex-grow: 0;
|
||||
flex-shrink: 0;
|
||||
flex-basis: 50%;
|
||||
text-align: justify;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 500px) {
|
||||
width: ~"calc(100% - 30px)";
|
||||
}
|
||||
@@ -50,7 +60,7 @@
|
||||
h2 .cp-creation-help {
|
||||
display: inline;
|
||||
}
|
||||
p {
|
||||
.cp-creation-help-container {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
0
customize.dist/translations/messages.el.js
Executable file → Normal file
0
customize.dist/translations/messages.el.js
Executable file → Normal file
@@ -866,16 +866,16 @@ define(function () {
|
||||
out.creation_ownedTitle = "Type of pad";
|
||||
out.creation_ownedTrue = "Owned pad";
|
||||
out.creation_ownedFalse = "Open pad";
|
||||
out.creation_owned1 = "An <b>owned</b> pad is a pad that you can delete from the server whenever you want. Once it is deleted, no one else can access it, even if it is stored in their CryptDrive.";
|
||||
out.creation_owned1 = "An <b>owned</b> pad can be deleted from the server whenever the owner wants. Deleting an owned pad removes it from other users' CryptDrives.";
|
||||
out.creation_owned2 = "An <b>open</b> pad doesn't have any owner and thus, it can't be deleted from the server unless it has reached its expiration time.";
|
||||
out.creation_expireTitle = "Life time";
|
||||
out.creation_expireTrue = "Add a life time";
|
||||
out.creation_expireFalse = "Unlimited";
|
||||
out.creation_expireHours = "Hours";
|
||||
out.creation_expireDays = "Days";
|
||||
out.creation_expireMonths = "Months";
|
||||
out.creation_expire1 = "By default, a pad stored by a registered user will never be removed from the server, unless it is requested by its owner.";
|
||||
out.creation_expire2 = "If you prefer, you can set a life time to make sure the pad will be permanently deleted from the server and unavailable after the specified date.";
|
||||
out.creation_expireHours = "Hour(s)";
|
||||
out.creation_expireDays = "Day(s)";
|
||||
out.creation_expireMonths = "Month(s)";
|
||||
out.creation_expire1 = "An <b>unlimited</b> pad will not be removed from the server until its owner deletes it.";
|
||||
out.creation_expire2 = "An <b>expiring</b> pad has a set lifetime, after which it will be automatically removed from the server and other users' CryptDrives.";
|
||||
out.creation_createTitle = "Create a pad";
|
||||
out.creation_createFromTemplate = "From template";
|
||||
out.creation_createFromScratch = "From scratch";
|
||||
|
||||
Reference in New Issue
Block a user