<commit_before>import classNames from 'classnames';
/* eslint-disable no-unused-vars */
import React from 'react';
/* eslint-enable no-unused-vars */

import FieldInput from './FieldInput';
import IconEdit from './icons/IconEdit';

const METHODS_TO_BIND = ['handleOnFocus'];

export default class FieldPassword extends FieldInput {
  constructor() {
    super();

    METHODS_TO_BIND.forEach((method) => {
      this[method] = this[method].bind(this);
    });
  }

  handleOnFocus(event) {
    if (!this.focused) {
      this.focused = true;
      this.forceUpdate();
    }

    this.props.handleEvent('focus', this.props.name, event);
  }

  getInputElement(attributes) {
    let classes = classNames(this.props.inputClass, this.props.sharedClass);
    let inputContent = null;
    attributes = this.bindEvents(attributes, this.props.handleEvent);
    attributes.onFocus = this.handleOnFocus;

    let startValue = attributes.startValue || '';

    if (this.isEditing() || this.props.writeType === 'input') {
      inputContent = (
        <input
          {...attributes}
          ref="inputElement"
          className={classes}
          onKeyDown={this.handleKeyDown.bind(this)}
          value={startValue} />
      );
    } else {
      inputContent = (
        <span
          ref="inputElement"
          {...attributes}
          className={classes}
          onClick={attributes.onFocus}>
          <span className={this.props.inlineTextClass}>
            {attributes.defaultPasswordValue || DEFAULT_PASSWORD_TEXT}
          </span>
          <span className={this.props.inlineIconClass}>
            <IconEdit />
          </span>
        </span>
      );
    }<commit_msg>Restore defaultPasswordValue attribute<commit_after>import classNames from 'classnames';
/* eslint-disable no-unused-vars */
import React from 'react';
/* eslint-enable no-unused-vars */

import FieldInput from './FieldInput';
import IconEdit from './icons/IconEdit';

const METHODS_TO_BIND = ['handleOnBlur', 'handleOnFocus'];

export default class FieldPassword extends FieldInput {
  constructor() {
    super();

    METHODS_TO_BIND.forEach((method) => {
      this[method] = this[method].bind(this);
    });
  }

  handleOnBlur(event) {
    if (this.focused) {
      this.focused = false;
      this.forceUpdate();
    }

    this.props.handleEvent('blur', this.props.name, event);
  }

  handleOnFocus(event) {
    if (!this.focused) {
      this.focused = true;
      this.forceUpdate();
    }

    this.props.handleEvent('focus', this.props.name, event);
  }

  getInputElement(attributes) {
    let classes = classNames(this.props.inputClass, this.props.sharedClass);
    let inputContent = null;
    attributes = this.bindEvents(attributes, this.props.handleEvent);
    attributes.onBlur = this.handleOnBlur;
    attributes.onFocus = this.handleOnFocus;

    let fieldValue = attributes.defaultPasswordValue ||
      attributes.startValue || '';

    if (this.focused) {
      fieldValue = attributes.startValue;
    }

    if (this.isEditing() || this.props.writeType === 'input') {
      inputContent = (
        <input
          {...attributes}
          ref="inputElement"
          className={classes}
          onKeyDown={this.handleKeyDown.bind(this)}
          value={fieldValue} />
      );
    } else {
      inputContent = (
        <span
          ref="inputElement"
          {...attributes}
          className={classes}
          onClick={attributes.onFocus}>
          <span className={this.props.inlineTextClass}>
            {attributes.defaultPasswordValue || DEFAULT_PASSWORD_TEXT}
          </span>
          <span className={this.props.inlineIconClass}>
            <IconEdit />
          </span>
        </span>
      );
    }
{'fraction_non_alphanumeric': 0.13267485317672184, 'fraction_numerical': 0.0, 'mean_word_length': 2.565176022835395, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4480156', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1064, 'n_words': 193}