Adds styling of "Confirm Password" Field in user forms

This patch adds the styling on the "Confirm Password" error message
shown when user enters different confirmation password.

Change-Id: If6dc9ec38979eef48e58d4f1b1ce157056e267e0
Closes-bug: #1418871
This commit is contained in:
nikunj2512 2015-02-06 16:36:48 +05:30
parent ba1fe99f40
commit dd88b010d0

View File

@ -13,19 +13,20 @@ horizon.user = {
},
check_passwords_match: function() {
var row = $("label[for='id_confirm_password']");
var row = $("input#id_confirm_password");
var error_id = "id_confirm_password_error";
var msg = "<span id='" + error_id + "' class='help-block'>" + gettext("Passwords do not match.") + "</span>";
var msg = "<span id='" + error_id + "' class='help-block alert alert-danger'>" + gettext("Passwords do not match.") + "</span>";
var password = $("#id_password").val();
var confirm_password = $("#id_confirm_password").val();
if (password !== confirm_password && $("#" + error_id).length === 0) {
$(row).parent().addClass("error");
$(row).parent().addClass("has-error");
$(row).after(msg);
} else if (password === confirm_password) {
$(row).parent().removeClass("error");
$(row).parent().removeClass("has-error");
$("#" + error_id).remove();
}
}
};