Show/Hide password on change password view

Is it possible through theme editing to add a show/hide button in the reset password form?

I have been looking for that view through theme editing but I don’t find anything specific

I think this is the template you’re looking for: keycloak/login-update-password.ftl at master · keycloak/keycloak · GitHub

1 Like

You can do this with js and css without modifying the keycloak templates…

// Rudimentary method for adding a password reveal button.
window.onload = function() {
  var fToggle = function($password, e) {
    const type = $password.getAttribute('type') === 'password' ? 'text' : 'password';
    $password.setAttribute('type', type);

  var createReveal = function(passwordId, toggleId) {
    var password = document.getElementById(passwordId);
    if ((password) && ( && ( !== 'none')){
      var icon = document.createElement("i"); = toggleId;
      icon.classList.add('password-reveal', 'bi', 'bi-eye-slash');
      icon.addEventListener('click', fToggle.bind(icon, password)); 
      password.parentNode.insertBefore(icon, password.nextSibling);

  createReveal('password', 'togglePassword');
  createReveal('password-new', 'togglePasswordNew');
  createReveal('password-confirm', 'togglePasswordConfirm');


.password-reveal {
  color: #5500B3;
  margin-left: -40px;
  font-size: 20px;
  cursor: pointer;

Yep, I confirmed it recently, thanks!

I was actually trying to edit the ftl template, your solution seems cleaner.

I’m gonna try it, thanks!

1 Like

Hello @Jonskadev @zepp0 I’m new in keycloak and I need to apply this feature (show/hide password). I was trying to modify the ftl files without any success.

Where/how should the js and css of your answer be implemented?

Hi there. You’re going to need to create a Custom Theme. You can find articles on this online. This one is a pretty good overview:

Here’s a starter maven project for creating your own custom theme:

Hey! I can not understand how we can run this JS script in keycloak?