<commit_before>import React from 'react';
import $ from 'jquery';

export default class SettingsView extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      firstName: '',
      lastName: '',
      email: '',
      password: ''
    }
  }

  componentWillMount() {
    this._getCurrentUser(function(currentUser) {
      this.setState({
        firstName: currentUser.firstName,
        lastName: currentUser.lastName,
        email: currentUser.email,
        password: <PASSWORD>
      })
    }.bind(this));
  }

  _getCurrentUser(callback) {
    $.ajax({
      method: 'GET',
      url: '/api/users',
      success: function(data) {
        // console.log(data);
        callback(data);
      },
      error: function(err) {
        console.error('_getCurrentUser error', err);
      }
    });
  }

  render() {
    return (
      <div className="view settings-view">
        <h4 className="settings-view-welcome">Profile Settings</h4>
        <h4 className="settings-view-instructions">Update your user settings below.</h4>
        <form method="PUT" action="/api/users">
          <div className="update-form-label">First Name</div>
          <div className="update-form-input firstname">
            <input type="text" name="firstname" placeholder="Update First Name" value={this.state.firstName} required></input>
          </div>
          <div className="update-form-label">Last Name</div>
          <div className="update-form-input lastname">
            <input type="text" name="lastname" placeholder="Update Last Name" value={this.state.lastName} required></input>
          </div>
          <div className="update-form-label">Email</div>
          <div className="update-form-input Email">
            <input type="text" name="Email" placeholder="Update Email" value={this.state.email} required></input>
          </div>
          <div className="update-form-label">Password</div>
          <div className="update-form-input password">
            <input type="password" name="password" placeholder="<PASSWORD>" required></input>
          </div>
          <button className="update-button">Update Profile</button>
        </form>
      </div>
    )
  }
}<commit_msg>Change initializing the update form using React refs<commit_after>import React from 'react';
import $ from 'jquery';

export default class SettingsView extends React.Component {
  constructor(props) {
    super(props);
  }

  componentWillMount() {
    this._getCurrentUser(function(currentUser) {
      this.refs.firstName.value = currentUser.firstName;
      this.refs.lastName.value = currentUser.lastName;
      this.refs.email.value = currentUser.email;
      this.refs.password.value = currentUser.password;
    }.bind(this));
  }

  _getCurrentUser(callback) {
    $.ajax({
      method: 'GET',
      url: '/api/users',
      success: function(data) {
        // console.log(data);
        callback(data);
      },
      error: function(err) {
        console.error('_getCurrentUser error', err);
      }
    });
  }

  render() {
    return (
      <div className="view settings-view">
        <h4 className="settings-view-welcome">Profile Settings</h4>
        <h4 className="settings-view-instructions">Update your user settings below.</h4>
        <form method="PUT" action="/api/users">
          <div className="update-form-label">First Name</div>
          <div className="update-form-input firstname">
            <input type="text" name="firstname" placeholder="Update First Name" ref="firstName" required></input>
          </div>
          <div className="update-form-label">Last Name</div>
          <div className="update-form-input lastname">
            <input type="text" name="lastname" placeholder="Update Last Name" ref="lastName" required></input>
          </div>
          <div className="update-form-label">Email</div>
          <div className="update-form-input Email">
            <input type="text" name="Email" placeholder="Update Email" ref="email" required></input>
          </div>
          <div className="update-form-label">Password</div>
          <div className="update-form-input password">
            <input type="password" name="password" placeholder="<PASSWORD>" ref="password" required></input>
          </div>
          <button className="update-button">Update Profile</button>
        </form>
      </div>
    )
  }
}
{'fraction_non_alphanumeric': 0.14715947980835045, 'fraction_numerical': 0.0018252338580880675, 'mean_word_length': 2.684033613445378, 'pattern_counts': {'":': 0, '<': 74, '<?xml version=': 0, '>': 74, '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': '6606500', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1215, 'n_words': 248}