mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Update togglePassword to change icon based on visibility state
This commit is contained in:
parent
d636b15d88
commit
452e732a3a
2 changed files with 16 additions and 3 deletions
|
@ -182,11 +182,17 @@ function loadUserList(context, apiClient, users) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function togglePassword() {
|
function togglePassword() {
|
||||||
const input = document.getElementById('txtManualPassword');
|
const input = document.querySelector('.inputContainer #txtManualPassword');
|
||||||
|
const icon = document.querySelector('.inputContainer .passwordToggle .material-icons');
|
||||||
|
|
||||||
if (input.type === 'password') {
|
if (input.type === 'password') {
|
||||||
input.type = 'text';
|
input.type = 'text';
|
||||||
|
icon.classList.remove('visibility');
|
||||||
|
icon.classList.add('visibility_off');
|
||||||
} else {
|
} else {
|
||||||
input.type = 'password';
|
input.type = 'password';
|
||||||
|
icon.classList.remove('visibility_off');
|
||||||
|
icon.classList.add('visibility');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,8 +76,15 @@ function togglePassword() {
|
||||||
const inputIds = ['txtManualPassword', 'txtPasswordConfirm'];
|
const inputIds = ['txtManualPassword', 'txtPasswordConfirm'];
|
||||||
inputIds.forEach(id => {
|
inputIds.forEach(id => {
|
||||||
const input = document.getElementById(id);
|
const input = document.getElementById(id);
|
||||||
if (input) {
|
input.type = (input.type === 'password') ? 'text' : 'password';
|
||||||
input.type = (input.type === 'password') ? 'text' : 'password';
|
});
|
||||||
|
document.querySelectorAll('.passwordToggle .material-icons').forEach(icon => {
|
||||||
|
if (icon.classList.contains('visibility')) {
|
||||||
|
icon.classList.remove('visibility');
|
||||||
|
icon.classList.add('visibility_off');
|
||||||
|
} else {
|
||||||
|
icon.classList.remove('visibility_off');
|
||||||
|
icon.classList.add('visibility');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue