Permalink
Browse files

Restore pw validation in edit form

  • Loading branch information...
flack committed Oct 23, 2017
1 parent ca5e16b commit 8718e940c1c1c3277303dcb348ee397c2ce04169
Showing with 9 additions and 6 deletions.
  1. +1 −2 lib/org/openpsa/user/handler/person/account.php
  2. +8 −4 lib/org/openpsa/user/widget/password.php
@@ -128,9 +128,8 @@ public function _handler_edit($handler_id, array $args, array &$data)
}
midcom::get()->head->set_pagetitle($this->_l10n->get('edit account'));
org_openpsa_user_widget_password::jsinit('input[name="org_openpsa_user[new_password][first]"]', $this->_l10n, $this->_config, true);
$controller = $this->load_controller();
$workflow = $this->get_workflow('datamanager', ['controller' => $controller]);
if ($this->person->can_do('midgard:update')) {
@@ -34,10 +34,14 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'label_attr' => ['style' => 'display: none']
]);
midcom::get()->head->add_jsfile(MIDCOM_STATIC_URL . '/org.openpsa.user/password.js');
$l10n = midcom::get()->i18n->get_l10n('org.openpsa.user');
$config = midcom_baseclasses_components_configuration::get('org.openpsa.user', 'config');
self::jsinit('input[type="password"]', $l10n, $config, false);
}
public static function jsinit($name, midcom_services_i18n_l10n $l10n, midcom_helper_configuration $config, $userid_required)
{
midcom::get()->head->add_jsfile(MIDCOM_STATIC_URL . '/org.openpsa.user/password.js');
$conf = [
'strings' => [
'shortPass' => $l10n->get("password too short"),
@@ -49,9 +53,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'password_rules' => $config->get('password_score_rules'),
'min_length' => $config->get('min_password_length'),
'min_score' => $config->get('min_password_score'),
'userid_required' => false
'userid_required' => $userid_required
];
$conf = json_encode($conf);
midcom::get()->head->add_jquery_state_script('$(\'input[type="password"]\').password_widget(' . $conf . ');');
midcom::get()->head->add_jquery_state_script("$('" . $name . "').password_widget(" . $conf . ");");
}
}

0 comments on commit 8718e94

Please sign in to comment.