wekan/client/components/users/passwordInput.js
Lauri Ojansivu d30192f7f9 Show password at Login and Register pages.
Thanks to xet7 !

Fixes #6070
2026-01-17 19:40:07 +02:00

46 lines
No EOL
1.3 KiB
JavaScript

import { TAPi18n } from '/imports/i18n';
Template.passwordInput.onRendered(function() {
const template = this;
const input = template.find('input.password-field');
const label = template.find('label');
// Set the dynamic id and name based on the field _id
if (template.data && template.data._id) {
const fieldId = `at-field-${template.data._id}`;
input.id = fieldId;
input.name = fieldId;
label.setAttribute('for', fieldId);
// Ensure the input starts as password type for password fields
input.type = 'password';
// Initially hide the slash line since password starts hidden
const slashLine = template.find('.eye-slash-line');
if (slashLine) {
slashLine.style.display = 'none';
}
}
});
Template.passwordInput.events({
'click .password-toggle-btn'(event, template) {
event.preventDefault();
const input = template.find('input.password-field');
const slashLine = template.find('.eye-slash-line');
if (input.type === 'password') {
input.type = 'text';
// Show the slash line when password is visible
if (slashLine) {
slashLine.style.display = 'block';
}
} else {
input.type = 'password';
// Hide the slash line when password is hidden
if (slashLine) {
slashLine.style.display = 'none';
}
}
},
});