Aleksander Machniak
2014-11-20 0b36d151572e050b51d82e7429fee847ebb33e22
plugins/password/password.php
@@ -57,6 +57,8 @@
                return;
            }
            $this->add_texts('localization/');
            $this->add_hook('settings_actions', array($this, 'settings_actions'));
            $this->register_action('plugin.password', array($this, 'password_init'));
@@ -75,13 +77,19 @@
    function settings_actions($args)
    {
        // register as settings action
        $args['actions'][] = array('action' => 'plugin.password', 'class' => 'password', 'label' => 'password', 'domain' => 'password');
        $args['actions'][] = array(
            'action' => 'plugin.password',
            'class'  => 'password',
            'label'  => 'password',
            'title'  => 'changepasswd',
            'domain' => 'password',
        );
        return $args;
    }
    function password_init()
    {
        $this->add_texts('localization/');
        $this->register_handler('plugin.body', array($this, 'password_form'));
        $rcmail = rcmail::get_instance();
@@ -96,7 +104,6 @@
    function password_save()
    {
        $this->add_texts('localization/');
        $this->register_handler('plugin.body', array($this, 'password_form'));
        $rcmail = rcmail::get_instance();
@@ -219,22 +226,41 @@
        $table->add('title', html::label($field_id, rcube::Q($this->gettext('confpasswd'))));
        $table->add(null, $input_confpasswd->show());
        $rules = '';
        $required_length = intval($rcmail->config->get('password_minimum_length'));
        if ($required_length > 0) {
            $rules .= html::tag('li', array('id' => 'required-length'), $this->gettext(array(
                'name' => 'passwordshort',
                'vars' => array('length' => $required_length)
            )));
        }
        if ($rcmail->config->get('password_require_nonalpha')) {
            $rules .= html::tag('li', array('id' => 'require-nonalpha'), $this->gettext('passwordweak'));
        }
        if (!empty($rules)) {
            $rules = html::tag('ul', array('id' => 'ruleslist'), $rules);
        }
        $out = html::div(array('class' => 'box'),
            html::div(array('id' => 'prefs-title', 'class' => 'boxtitle'), $this->gettext('changepasswd')) .
            html::div(array('class' => 'boxcontent'), $table->show() .
            $rules .
            html::p(null,
                $rcmail->output->button(array(
                    'command' => 'plugin.password-save',
                    'type' => 'input',
                    'class' => 'button mainaction',
                    'label' => 'save'
                    'type'    => 'input',
                    'class'   => 'button mainaction',
                    'label'   => 'save'
            )))));
        $rcmail->output->add_gui_object('passform', 'password-form');
        return $rcmail->output->form_tag(array(
            'id' => 'password-form',
            'name' => 'password-form',
            'id'     => 'password-form',
            'name'   => 'password-form',
            'method' => 'post',
            'action' => './?_task=settings&_action=plugin.password-save',
        ), $out);
@@ -280,10 +306,10 @@
        switch ($result) {
            case PASSWORD_SUCCESS:
                return;
            case PASSWORD_CRYPT_ERROR;
            case PASSWORD_CRYPT_ERROR:
                $reason = $this->gettext('crypterror');
                break;
            case PASSWORD_CONNECT_ERROR;
            case PASSWORD_CONNECT_ERROR:
                $reason = $this->gettext('connecterror');
                break;
            case PASSWORD_ERROR: