From 3915b300557760ef3704daffca0df46944f9570b Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 29 May 2017 13:11:07 +0200 Subject: [PATCH] provide a register button on login also direct users from file to login --- customize.dist/main.css | 6 ++++++ customize.dist/src/less/cryptpad.less | 8 ++++++++ customize.dist/translations/messages.js | 4 ++++ www/file/main.js | 7 ++++++- www/login/index.html | 4 ++++ www/login/main.js | 11 +++++++++++ 6 files changed, 39 insertions(+), 1 deletion(-) diff --git a/customize.dist/main.css b/customize.dist/main.css index 063324504..50572f14b 100644 --- a/customize.dist/main.css +++ b/customize.dist/main.css @@ -875,6 +875,12 @@ html.cp, .cp #main_other #main-container { display: inline-block; } +.cp #main #userForm .extra p, +.cp #main_other #userForm .extra p { + font-size: 28px; + padding: 15px; + text-align: center; +} .cp #main #data, .cp #main_other #data { width: 600px; diff --git a/customize.dist/src/less/cryptpad.less b/customize.dist/src/less/cryptpad.less index 0ee8785e6..49608df00 100644 --- a/customize.dist/src/less/cryptpad.less +++ b/customize.dist/src/less/cryptpad.less @@ -337,6 +337,14 @@ noscript { display: inline-block; } + #userForm .extra { + p { + font-size: 28px; + padding: 15px; + text-align: center; + } + } + #data { p { margin: 0; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index d39407194..c28172017 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -302,6 +302,9 @@ define(function () { out.login_invalPass = 'Password required'; out.login_unhandledError = 'An unexpected error occurred :('; + out.login_notRegistered = 'Not registered?'; + + out.register_importRecent = "Import pad history (Recommended)"; out.register_acceptTerms = "I accept the terms of service"; out.register_passwordsDontMatch = "Passwords do not match!"; @@ -375,6 +378,7 @@ define(function () { out.upload_name = "File name"; out.upload_size = "Size"; out.upload_progress = "Progress"; + out.upload_mustLogin = "You must be logged in to upload files"; out.download_button = "Decrypt & Download"; // general warnings diff --git a/www/file/main.js b/www/file/main.js index ff0d52ec4..8df236235 100644 --- a/www/file/main.js +++ b/www/file/main.js @@ -301,7 +301,12 @@ define([ } if (!Cryptpad.isLoggedIn()) { - return Cryptpad.alert("You must be logged in to upload files"); + return Cryptpad.alert(Messages.upload_mustLogin, function () { + if (sessionStorage) { + sessionStorage.redirectTo = window.location.href; + } + window.location.href = '/login/'; + }); } $form.css({ diff --git a/www/login/index.html b/www/login/index.html index e01c78a09..3e4e7a21e 100644 --- a/www/login/index.html +++ b/www/login/index.html @@ -62,6 +62,10 @@ +
+

+ +
diff --git a/www/login/main.js b/www/login/main.js index 194c824ac..caa77fe4b 100644 --- a/www/login/main.js +++ b/www/login/main.js @@ -128,5 +128,16 @@ define([ }, 0); }, 100); }); + $('#register').on('click', function () { + if (sessionStorage) { + if ($uname.val()) { + sessionStorage.login_user = $uname.val(); + } + if ($passwd.val()) { + sessionStorage.login_pass = $passwd.val(); + } + } + window.location.href = '/register/'; + }); }); });