Ability to import local pads on login

pull/1/head
yflory 7 years ago
parent a5b75e0164
commit f3d8fd3590

@ -570,6 +570,19 @@ define([
'name': 'password', 'name': 'password',
placeholder: Msg.login_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($('<label for="import-recent"></label>')[0], Msg.register_importRecent)
/*h('label', {
'for': 'import-recent',
}, Msg.register_importRecent),*/
]),
h('div.extra', [ h('div.extra', [
h('button.login.first.btn', Msg.login_login) h('button.login.first.btn', Msg.login_login)
]) ])

@ -12,6 +12,7 @@ define([
], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore, Test) { ], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore, Test) {
$(function () { $(function () {
var $main = $('#mainBlock'); var $main = $('#mainBlock');
var $checkImport = $('#import-recent');
var Messages = Cryptpad.Messages; var Messages = Cryptpad.Messages;
// main block is hidden in case javascript is disabled // 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"); } if (hashing) { return void console.log("hashing is already in progress"); }
hashing = true; hashing = true;
var shouldImport = $checkImport[0].checked;
// setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up // setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up
window.setTimeout(function () { window.setTimeout(function () {
@ -96,6 +98,9 @@ define([
test.pass(); test.pass();
return; return;
} }
if (shouldImport) {
sessionStorage.migrateAnonDrive = 1;
}
if (sessionStorage.redirectTo) { if (sessionStorage.redirectTo) {
var h = sessionStorage.redirectTo; var h = sessionStorage.redirectTo;
var parser = document.createElement('a'); var parser = document.createElement('a');

Loading…
Cancel
Save