feat: added toggle for password, to show it for editting purposes
This commit is contained in:
parent
7dbbab410a
commit
18b1e9d9fd
@ -827,11 +827,22 @@
|
||||
<label class="block text-gray-700 text-sm font-bold mb-2"
|
||||
>Пароль</label
|
||||
>
|
||||
<input
|
||||
type="password"
|
||||
id="userPassword"
|
||||
class="form-input w-full px-3 py-2 rounded-lg"
|
||||
/>
|
||||
<div class="relative">
|
||||
<input
|
||||
type="password"
|
||||
id="userPassword"
|
||||
class="form-input w-full px-3 py-2 rounded-lg"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
id="togglePasswordBtn"
|
||||
class="absolute right-3 top-1/4 -translate-y-1/2 text-xl text-gray-500 hover:text-gray-700"
|
||||
tabindex="-1"
|
||||
aria-label="Показать пароль"
|
||||
>
|
||||
<span id="eyeIcon">👁️</span>
|
||||
</button>
|
||||
</div>
|
||||
<small class="text-gray-500"
|
||||
>Оставьте пустым, чтобы не менять пароль</small
|
||||
>
|
||||
|
@ -484,7 +484,7 @@ async function loadReports() {
|
||||
return;
|
||||
}
|
||||
|
||||
//Extract reports array
|
||||
// extract reports array
|
||||
const reports = result.reports;
|
||||
const stores = appState.storesList || [];
|
||||
|
||||
@ -1443,13 +1443,21 @@ function showUserEditModal(user) {
|
||||
document.getElementById("userLogin").value = (user && user.username) || "";
|
||||
const loginInput = document.getElementById("userLogin");
|
||||
loginInput.value = (user && user.username) || "";
|
||||
if (appState.editingUserId) {
|
||||
loginInput.disabled = true;
|
||||
} else {
|
||||
loginInput.disabled = false;
|
||||
}
|
||||
// if (appState.editingUserId) {
|
||||
// loginInput.disabled = true;
|
||||
// } else {
|
||||
// loginInput.disabled = false;
|
||||
// }
|
||||
|
||||
document.getElementById("userPassword").value = "";
|
||||
document.getElementById("userPassword").value =
|
||||
user && user.plaintextPassword ? user.plaintextPassword : "";
|
||||
|
||||
const pwInput = document.getElementById("userPassword");
|
||||
pwInput.value = user && user.plaintextPassword ? user.plaintextPassword : "";
|
||||
pwInput.type = "password"; // Always set hidden on open!
|
||||
|
||||
const eye = document.getElementById("eyeIcon");
|
||||
if (eye) eye.textContent = "👁️";
|
||||
document.getElementById("userRole").value = (user && user.role) || "employee";
|
||||
|
||||
// Загрузка чекбоксов магазинов
|
||||
@ -1472,6 +1480,19 @@ function showUserEditModal(user) {
|
||||
showModal("userEditModal");
|
||||
}
|
||||
|
||||
//eye toggle for the password
|
||||
document.getElementById("togglePasswordBtn").onclick = function () {
|
||||
const pw = document.getElementById("userPassword");
|
||||
const eye = document.getElementById("eyeIcon");
|
||||
if (pw.type === "password") {
|
||||
pw.type = "text";
|
||||
eye.textContent = "🙈";
|
||||
} else {
|
||||
pw.type = "password";
|
||||
eye.textContent = "👁️";
|
||||
}
|
||||
};
|
||||
|
||||
//save user for create and update
|
||||
async function saveUser() {
|
||||
const login = document.getElementById("userLogin").value.trim();
|
||||
|
Loading…
Reference in New Issue
Block a user