From b83204bf2cac18ed2fa1f07770a172932392abcc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= <danxuliu@gmail.com>
Date: Sat, 6 Jan 2018 00:13:23 +0100
Subject: [PATCH] Add strengthify bar after plain text input clone of password
 input
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

To show the password in plain text "showPassword" adds a text input
after the password input and swaps their visibility depending on whether
the password has to be shown in plain text or not. In a similar way,
"strengthify" by default adds the strength bar after the input element
it was called on. Due to this, if "showPassword" is called before
"strengthify" on the same password input then the strength bar ends
between the password input and the text input, and when the text input
is shown it appears below the strength bar.

To fix this now the strength bar is added after the text input in those
places in which "strengthify" was called after "showPassword" on the
same element.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
---
 apps/user_ldap/js/renewPassword.js   | 1 +
 settings/js/settings/personalInfo.js | 1 +
 2 files changed, 2 insertions(+)

diff --git a/apps/user_ldap/js/renewPassword.js b/apps/user_ldap/js/renewPassword.js
index bea2c0409f7..7a58832c984 100644
--- a/apps/user_ldap/js/renewPassword.js
+++ b/apps/user_ldap/js/renewPassword.js
@@ -46,5 +46,6 @@ $(document).ready(function() {
 			t('core', 'Strong password')
 		],
 		drawTitles: true,
+		$addAfter: $('input[name="newPassword-clone"]'),
 	});
 });
diff --git a/settings/js/settings/personalInfo.js b/settings/js/settings/personalInfo.js
index 0a39e607762..99254c42090 100644
--- a/settings/js/settings/personalInfo.js
+++ b/settings/js/settings/personalInfo.js
@@ -395,6 +395,7 @@ $(document).ready(function () {
 			t('settings', 'Strong password')
 		],
 		drawTitles: true,
+		$addAfter: $('input[name="newpassword-clone"]'),
 	});
 
 	// Load the big avatar
-- 
GitLab