From f3d8fd359046af1684d33cbb3b57e0447e55cae6 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 12 Jan 2018 18:17:32 +0100 Subject: [PATCH] Ability to import local pads on login --- customize.dist/pages.js | 13 +++++++++++++ www/login/main.js | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/customize.dist/pages.js b/customize.dist/pages.js index 02757c711..f120beef1 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -570,6 +570,19 @@ define([ 'name': 'password', placeholder: Msg.login_password, }), + h('div.checkbox-container', [ + h('input#import-recent', { + name: 'import-recent', + type: 'checkbox', + checked: true + }), + // hscript doesn't generate for on label for some + // reason... use jquery as a temporary fallback + setHTML($('')[0], Msg.register_importRecent) + /*h('label', { + 'for': 'import-recent', + }, Msg.register_importRecent),*/ + ]), h('div.extra', [ h('button.login.first.btn', Msg.login_login) ]) diff --git a/www/login/main.js b/www/login/main.js index 408203d9b..f6a9cebb6 100644 --- a/www/login/main.js +++ b/www/login/main.js @@ -12,6 +12,7 @@ define([ ], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore, Test) { $(function () { var $main = $('#mainBlock'); + var $checkImport = $('#import-recent'); var Messages = Cryptpad.Messages; // main block is hidden in case javascript is disabled @@ -59,6 +60,7 @@ define([ if (hashing) { return void console.log("hashing is already in progress"); } hashing = true; + var shouldImport = $checkImport[0].checked; // setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up window.setTimeout(function () { @@ -96,6 +98,9 @@ define([ test.pass(); return; } + if (shouldImport) { + sessionStorage.migrateAnonDrive = 1; + } if (sessionStorage.redirectTo) { var h = sessionStorage.redirectTo; var parser = document.createElement('a');