diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js
index 2a14e9370..29d559223 100644
--- a/customize.dist/translations/messages.fr.js
+++ b/customize.dist/translations/messages.fr.js
@@ -290,6 +290,9 @@ define(function () {
out.register_importRecent = "Importer l'historique (Recommendé)";
out.register_acceptTerms = "J'accepte les conditions d'utilisation";
out.register_rememberPassword = "Je vais me souvenir de mes identifiants";
+ out.register_passwordsDontMatch = "Les mots de passe doivent être identiques!";
+ out.register_mustAcceptTerms = "Vous devez accepter les conditions d'utilisation.";
+ out.register_mustRememberPass = "Nous ne pouvons pas réinitialiser votre mot de passe si vous l'oubliez. C'est important que vous vous en souveniez!";
// index.html
diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js
index 942364b49..1bf258c28 100644
--- a/customize.dist/translations/messages.js
+++ b/customize.dist/translations/messages.js
@@ -289,8 +289,11 @@ define(function () {
out.login_unhandledError = 'An unexpected error occured :(';
out.register_importRecent = "Import pad history (Recommended)";
- out.register_acceptTerms = "I accept the terms of use";
+ out.register_acceptTerms = "I accept the terms of service";
out.register_rememberPassword = "I will remember my login name and password";
+ out.register_passwordsDontMatch = "Passwords do not match!";
+ out.register_mustAcceptTerms = "You must accept the terms of service.";
+ out.register_mustRememberPass = "We cannot reset your password if you forget it. It's very important that you remember it!";
// index.html
diff --git a/www/register/main.js b/www/register/main.js
index 247a216fe..901ced2ff 100644
--- a/www/register/main.js
+++ b/www/register/main.js
@@ -10,6 +10,8 @@ define([
Login: Login,
};
+ var Messages = Cryptpad.Messages;
+
$(function () {
var $main = $('#mainBlock');
@@ -71,20 +73,40 @@ define([
/* basic validation */
if (passwd !== confirmPassword) { // do their passwords match?
- return void Cryptpad.alert('passwords do not match!'); // XXX
+ return void Cryptpad.alert(Messages.register_passwordsDontMatch);
}
if (!doesAccept) { // do they accept the terms of service?
- return void Cryptpad.alert('you must accept the terms of service'); // XXX
+ return void Cryptpad.alert(Messages.register_mustAcceptTerms);
}
if (!doesPromise) { // do they promise to remember their password?
- return void Cryptpad.alert("We cannot reset your password if you forget it. It's very important that you remember it!"); // XXX
+ return void Cryptpad.alert(Messages.register_mustRememberPass);
}
+ Cryptpad.addLoadingScreen(Messages.login_hashing);
Login.loginOrRegister(uname, passwd, true, function (err, result) {
- if (err) { return void Cryptpad.alert(err); }
- console.log(result);
+ if (err) {
+ switch (err) {
+ case 'NO_SUCH_USER':
+ Cryptpad.removeLoadingScreen(function () {
+ Cryptpad.alert(Messages.login_noSuchUser);
+ });
+ break;
+ case 'INVAL_USER':
+ Cryptpad.removeLoadingScreen(function () {
+ Cryptpad.alert(Messages.login_invalUser);
+ });
+ break;
+ case 'INVAL_PASS':
+ Cryptpad.removeLoadingScreen(function () {
+ Cryptpad.alert(Messages.login_invalPass);
+ });
+ break;
+ default: // UNHANDLED ERROR
+ Cryptpad.errorLoadingScreen(Messages.login_unhandledError);
+ }
+ }
var proxy = result.proxy;
localStorage.User_hash = result.userHash;
@@ -97,7 +119,9 @@ define([
proxy.login_name = uname;
Cryptpad.whenRealtimeSyncs(result.realtime, function () {
- document.location.href = '/drive/';
+ Cryptpad.login(result.userHash, result.userName, function () {
+ document.location.href = '/drive/';
+ });
});
});
});