mirror of
https://github.com/zadam/trilium.git
synced 2025-11-04 20:36:13 +01:00
protected session in a dialog now works, proper reloading
This commit is contained in:
33
src/public/javascripts/dialogs/protected_session.js
Normal file
33
src/public/javascripts/dialogs/protected_session.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import protectedSessionService from "../services/protected_session.js";
|
||||
|
||||
const $dialog = $("#protected-session-password-dialog");
|
||||
const $passwordForm = $dialog.find(".protected-session-password-form");
|
||||
const $passwordInput = $dialog.find(".protected-session-password");
|
||||
|
||||
function show() {
|
||||
$dialog.modal();
|
||||
|
||||
$passwordInput.focus();
|
||||
}
|
||||
|
||||
function close() {
|
||||
// this may fal if the dialog has not been previously opened (not sure if still true with Bootstrap modal)
|
||||
try {
|
||||
$dialog.modal('hide');
|
||||
}
|
||||
catch (e) {}
|
||||
}
|
||||
|
||||
$passwordForm.submit(() => {
|
||||
const password = $passwordInput.val();
|
||||
$passwordInput.val("");
|
||||
|
||||
protectedSessionService.setupProtectedSession(password);
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
export default {
|
||||
show,
|
||||
close
|
||||
}
|
||||
Reference in New Issue
Block a user