<commit_before>import React, {Fragment} from 'react';
import {Link} from 'react-router-dom';
import {useAPICall} from 'apiclient';
import Section from 'component/section';
import Card from 'component/card';
import Button from 'component/button';
import Input, {useForm} from 'component/form';

const selectAPIResetPass = (api) => api.u.user.pass.forgot.confirm;

const ConfirmReset = ({match}) => {
  const [formState, updateForm] = useForm({
    key: props.match.params.key || '',
    new_password: '',
  });

  const [formStateConfirm, updateFormConfirm] = useForm({
    password_confirm: '',
  });

  const prehook = useCallback(() => {
    const {new_password} = formState;
    const {password_confirm} = formStateConfirm;
    if (new_password !== password_confirm) {
      return 'Passwords do not match';
    }
  }, [formState, formStateConfirm]);

  const [resetState, execReset] = useAPICall(
    selectAPIResetPass,
    [formState.key, formState.new_password],
    {},
    prehook,
  );

  const {loading, success, err} = resetState;

  const bar = success ? (
    <Fragment>
      <Link to="/x/login">
        <Button outline>Sign in</Button>
      </Link>
    </Fragment>
  ) : (
    <Fragment>
      <Link to="/x/login">
        <Button text>Cancel</Button>
      </Link>
      <Button primary onClick={this.resetpassword}>
        Reset Password
      </Button>
    </Fragment>
  );

  return (
    <Section container padded>
      <Card
        center
        size="md"
        restrictWidth<commit_msg>Fix reset password container not defined<commit_after>import React, {Fragment} from 'react';
import {Link} from 'react-router-dom';
import {useAPICall} from 'apiclient';
import Section from 'component/section';
import Card from 'component/card';
import Button from 'component/button';
import Input, {useForm} from 'component/form';

const selectAPIResetPass = (api) => api.u.user.pass.forgot.confirm;

const ConfirmReset = ({match}) => {
  const [formState, updateForm] = useForm({
    key: props.match.params.key || '',
    new_password: '',
  });

  const [formStateConfirm, updateFormConfirm] = useForm({
    password_confirm: '',
  });

  const prehook = useCallback(() => {
    const {new_password} = formState;
    const {password_confirm} = formStateConfirm;
    if (new_password !== password_confirm) {
      return 'Passwords do not match';
    }
  }, [formState, formStateConfirm]);

  const [resetState, execReset] = useAPICall(
    selectAPIResetPass,
    [formState.key, formState.new_password],
    {},
    prehook,
  );

  const {loading, success, err} = resetState;

  const bar = success ? (
    <Fragment>
      <Link to="/x/login">
        <Button outline>Sign in</Button>
      </Link>
    </Fragment>
  ) : (
    <Fragment>
      <Link to="/x/login">
        <Button text>Cancel</Button>
      </Link>
      <Button primary onClick={execReset}>
        Reset Password
      </Button>
    </Fragment>
  );

  return (
    <Section container padded>
      <Card
        center
        size="md"
        restrictWidth
{'fraction_non_alphanumeric': 0.13990825688073394, 'fraction_numerical': 0.0, 'mean_word_length': 3.1201079622132255, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 39, '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': '7133304', 'n_tokens_mistral': 936, 'n_tokens_neox': 925, 'n_words': 230}