/**
 * @class CM_FormField_Password
 * @extends CM_FormField_Text
 */
var CM_FormField_Password = CM_FormField_Text.extend({
  _class: 'CM_FormField_Password',

  _visibilityDesired: true,

  events: {
    'click .togglePasswordVisibility': function() {
      this.togglePasswordVisibility();
    }
  },

  ready: function() {
    this.enableTriggerChangeOnInput();
    this.on('change', function() {
      this._applyDesiredPasswordVisibility();
    });
    var self = this;
    this.getForm().on('submit', function() {
      self.togglePasswordVisibility(false);
    });
  },

  /**
   * @param {Boolean} [state]
   */
  togglePasswordVisibility: function(state) {
    if ('undefined' === typeof state) {
      state = !this._visibilityDesired;
    }
    this._visibilityDesired = state;
    this.$('.mode-text').toggle(state);
    this.$('.mode-password').toggle(!state);
    this._applyDesiredPasswordVisibility();
  },

  _applyDesiredPasswordVisibility: function() {
    if (0 === this.getValue().length) {
      this._togglePasswordVisibilityInput(false);
    } else {
      this._togglePasswordVisibilityInput(this._visibilityDesired);
    }
  },

  /**
   * @param {Boolean} state
   */
  _togglePasswordVisibilityInput: function(state) {
    this.getInput().attr('type', state ? 'text' : 'password');
  }
});

@@ -183,16 +183,35 @@
  true,%0A%0A
+  _valueLast: '',%0A%0A
   events
@@ -587,24 +587,337 @@
   %7D);%0A  %7D,%0A%0A
+  triggerChange: function() %7B%0A    var valueCurrent = this.getInput().val();%0A    //it means we that 'paste' event has occurred.%0A    if (valueCurrent.length - this._valueLast.length %3E 1) %7B%0A      this.togglePasswordVisibility(false);%0A    %7D%0A    CM_FormField_Text.prototype.triggerChange.apply(this, arguments);%0A  %7D,%0A%0A
   /**%0A   * @

Handle 'paste' that does not trigger its event.