<commit_before><?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

/**
 * AdminUserEditPasswordForm
 *
 * @package    OpenPNE
 * @subpackage form
 * @author     <NAME> <<EMAIL>>
 */
class AdminUserEditPasswordForm extends AdminUserForm
{
  public function configure()
  {
    $this->setWidgets(array(
      'old_password' => new sfWidgetFormInputPassword(),
      'new_password' => new sfWidgetFormInputPassword(),
    ));

    $this->setValidators(array(
      'old_password' => new sfValidatorString(array('max_length' => 40, 'trim' => true)),
      'new_password' => new sfValidatorString(array('max_length' => 40, 'trim' => true)),
    ));

    $this->widgetSchema->setNameFormat('admin_user[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->validatorSchema->setPostValidator(new sfValidatorCallback(array(
      'callback'  => array('AdminUserEditPasswordForm', 'validate'),
      'arguments' => array('object' => $this->getObject()),
    )));

    $this->widgetSchema->setLabels(array(
      'old_password' => 'Old password',
      'new_password' => '<PASSWORD>',
    ));
  }

  public static function validate($validator, $values, $arguments = array())
  {
    if ($arguments['object']->getPassword() === md5($values['old_password']))
    {
      $values['username'] = $arguments['object']->getUsername();
      $values['password'] = $values['new_password'];
<commit_msg>(refs #2649) removed unnesessary setLabel<commit_after><?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

/**
 * AdminUserEditPasswordForm
 *
 * @package    OpenPNE
 * @subpackage form
 * @author     <NAME> <<EMAIL>>
 */
class AdminUserEditPasswordForm extends AdminUserForm
{
  public function configure()
  {
    $this->setWidgets(array(
      'old_password' => new sfWidgetFormInputPassword(),
      'new_password' => new sfWidgetFormInputPassword(),
    ));

    $this->setValidators(array(
      'old_password' => new sfValidatorString(array('max_length' => 40, 'trim' => true)),
      'new_password' => new sfValidatorString(array('max_length' => 40, 'trim' => true)),
    ));

    $this->widgetSchema->setNameFormat('admin_user[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->validatorSchema->setPostValidator(new sfValidatorCallback(array(
      'callback'  => array('AdminUserEditPasswordForm', 'validate'),
      'arguments' => array('object' => $this->getObject()),
    )));
  }

  public static function validate($validator, $values, $arguments = array())
  {
    if ($arguments['object']->getPassword() === md5($values['old_password']))
    {
      $values['username'] = $arguments['object']->getUsername();
      $values['password'] = $values['<PASSWORD>_password'];

{'fraction_non_alphanumeric': 0.16235813366960908, 'fraction_numerical': 0.004413619167717529, 'mean_word_length': 4.2795341098169715, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6817160', 'n_tokens_mistral': 941, 'n_tokens_neox': 925, 'n_words': 204}