✨ feat: Encrypt
This commit is contained in:
@@ -40,10 +40,21 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
|
||||
<% } %> <%- partial('google-analytics') %> <%- partial('baidu-analytics')
|
||||
%>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@sweetalert2/theme-bulma@5.0.1/bulma.min.css"
|
||||
/>
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.0.19/dist/sweetalert2.min.js"></script>
|
||||
|
||||
<!-- mermaid -->
|
||||
<% if (theme.mermaid.enable) { %>
|
||||
<script src="<%= theme.mermaid.cdn %>"></script>
|
||||
<% } %>
|
||||
<style>
|
||||
.swal2-styled.swal2-confirm {
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</html>
|
||||
</html>
|
||||
|
37
layout/_partial/lock.ejs
Normal file
37
layout/_partial/lock.ejs
Normal file
@@ -0,0 +1,37 @@
|
||||
<% if (theme.lock.enable){ %>
|
||||
<script>
|
||||
const password = "<%= theme.lock.password %>";
|
||||
const lock_password = window.sessionStorage.getItem("lock_password");
|
||||
console.log(password, lock_password);
|
||||
if (lock_password !== password) {
|
||||
Swal.fire({
|
||||
title: "<%= __('lock.lock_info') %>",
|
||||
input: "text",
|
||||
inputAttributes: {
|
||||
autocapitalize: "off",
|
||||
},
|
||||
showCancelButton: false,
|
||||
showLoaderOnConfirm: true,
|
||||
allowOutsideClick: false,
|
||||
confirmButtonText: "<%= __('lock.confirm_text') %>",
|
||||
}).then((result) => {
|
||||
console.log(result);
|
||||
if (result.isConfirmed) {
|
||||
console.log(password);
|
||||
if (result.value === password) {
|
||||
window.sessionStorage.setItem("lock_password", result.value);
|
||||
} else {
|
||||
Swal.fire({
|
||||
icon: "error",
|
||||
title: "<%= __('lock.lock_error') %>",
|
||||
confirmButtonText: "<%= __('lock.confirm_text') %>",
|
||||
allowOutsideClick: false,
|
||||
}).then(() => {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<% } %>
|
@@ -34,6 +34,7 @@
|
||||
<% if (theme.music&&theme.music.enable){ %>
|
||||
<%- partial('_partial/music') %>
|
||||
<% } %>
|
||||
<%- partial('_partial/lock') %>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
Reference in New Issue
Block a user