generated from OCA/oca-addons-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
T1775 show password on login/signup forms (#45)
* feat: replace the input password and add fa-eye * feat: replace the input confirm_password and add fa-eye * feat: create and add js file * feat: Finalize JavaScript file for password visibility toggle on sign up * fix: fix indentation with pre-commit in show_password.js * fix: fix indentation with pre-commit in signup.xml * fix: fix pre-commit warnings by avoiding "replace" in XML - Updated XML files to use safer `position` options. --------- Co-authored-by: jordyBSK <dylan.bossoku@jobtrek.ch>
- Loading branch information
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
document.addEventListener("DOMContentLoaded", function (event) { | ||
odoo.define("my_compassion.show_password", function (require) { | ||
"use strict"; | ||
|
||
function togglePasswordVisibility(inputId, icon) { | ||
const input = document.getElementById(inputId); | ||
if (input) { | ||
if (input.type === "password") { | ||
input.type = "text"; | ||
icon.classList.add("fa-eye-slash"); | ||
icon.classList.remove("fa-eye"); | ||
} else { | ||
input.type = "password"; | ||
icon.classList.add("fa-eye"); | ||
icon.classList.remove("fa-eye-slash"); | ||
} | ||
} | ||
} | ||
|
||
function addPasswordToggleListener(eyeId, inputId) { | ||
const eyeIcon = document.getElementById(eyeId); | ||
if (eyeIcon) { | ||
eyeIcon.addEventListener("click", function () { | ||
togglePasswordVisibility(inputId, eyeIcon); | ||
}); | ||
} | ||
} | ||
|
||
addPasswordToggleListener("eye_password", "password"); | ||
addPasswordToggleListener("eye_confirm_password", "confirm_password"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters