Plugin Directory

Changeset 665236


Ignore:
Timestamp:
02/08/2013 03:00:08 PM (13 years ago)
Author:
glatze
Message:

Added a switch for (re-)enabling lost password recovery.

Location:
active-directory-integration/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • active-directory-integration/trunk/ad-integration.php

    r622590 r665236  
    196196    // Update password on every successfull login
    197197    protected $_auto_update_password = false;
     198   
     199    // Enable lost password recovery
     200    protected $_enable_lost_password_recovery = false;
    198201   
    199202   
     
    266269            // Security
    267270            array('name' => 'AD_Integration_fallback_to_local_password', 'type' => 'bool'),
     271            array('name' => 'AD_Integration_enable_lost_password_recovery', 'type' => 'bool'),
    268272            array('name' => 'AD_Integration_max_login_attempts', 'type' => 'int'),
    269273            array('name' => 'AD_Integration_block_time', 'type' => 'int'),
     
    338342            add_filter('authenticate', array(&$this, 'authenticate'), 10, 3);
    339343           
    340             add_action('lost_password', array(&$this, 'disable_function'));
     344            if (!$this->_enable_lost_password_recovery) {
     345                add_action('lost_password', array(&$this, 'disable_function'));
     346            }
    341347            add_action('retrieve_password', array(&$this, 'disable_function'));
    342348            add_action('password_reset', array(&$this, 'disable_function'));
     
    468474                add_site_option('AD_Integration_disable_users', false);
    469475                add_site_option('AD_Integration_fallback_to_local_password', false);
     476                add_site_option('AD_Integration_enable_lost_password_recovery', false);
    470477               
    471478                add_site_option('AD_Integration_syncback', false);
     
    512519                add_option('AD_Integration_auto_update_password', false);
    513520               
     521               
    514522                add_option('AD_Integration_max_login_attempts', '3');
    515523                add_option('AD_Integration_block_time', '30');
     
    519527                add_option('AD_Integration_disable_users', false);
    520528                add_option('AD_Integration_fallback_to_local_password', false);
     529                add_option('AD_Integration_enable_lost_password_recovery', false);
     530
    521531               
    522532                add_option('AD_Integration_syncback', false);
     
    569579        // Security
    570580        register_setting('ADI-security-settings', 'AD_Integration_fallback_to_local_password', array(&$this, 'sanitize_bool'));
     581        register_setting('ADI-security-settings', 'AD_Integration_enable_lost_password_recovery', array(&$this, 'sanitize_bool'));
    571582        register_setting('ADI-security-settings', 'AD_Integration_max_login_attempts', array(&$this, 'sanitize_max_login_attempts'));
    572583        register_setting('ADI-security-settings', 'AD_Integration_block_time', array(&$this, 'sanitize_block_time'));
     
    18601871            $this->_role_equivalent_groups      = get_site_option('AD_Integration_role_equivalent_groups');
    18611872           
    1862             // Security (6)
     1873            // Security (7)
    18631874            $this->_fallback_to_local_password  = get_site_option('AD_Integration_fallback_to_local_password');
     1875            $this->_enable_lost_password_recovery = (bool)get_site_option('AD_Integration_enable_lost_password_recovery');
    18641876            $this->_max_login_attempts          = (int)get_site_option('AD_Integration_max_login_attempts');
    18651877            $this->_block_time                  = (int)get_site_option('AD_Integration_block_time');
     
    19191931            // Security (6)
    19201932            $this->_fallback_to_local_password  = get_option('AD_Integration_fallback_to_local_password');
     1933            $this->_enable_lost_password_recovery = (bool)get_option('AD_Integration_enable_lost_password_recovery');
    19211934            $this->_max_login_attempts          = (int)get_option('AD_Integration_max_login_attempts');
    19221935            $this->_block_time                  = (int)get_option('AD_Integration_block_time');
     
    22962309            if ( !empty( $arrPost['AD_Integration_enable_password_change'] ) )
    22972310                update_site_option('AD_Integration_enable_password_change', $arrPost['AD_Integration_enable_password_change']);
     2311               
     2312            if ( !empty( $arrPost['AD_Integration_enable_lost_password_recovery'] ) )
     2313                update_site_option('AD_Integration_enable_lost_password_recovery', $arrPost['AD_Integration_enable_lost_password_recovery']);
    22982314
    22992315            if ( !empty( $arrPost['AD_Integration_show_attributes'] ) )
  • active-directory-integration/trunk/admin.php

    r622590 r665236  
    5353    });
    5454
     55
     56    function submitTestForm() {
     57        openTestWindow();
     58        return false; // so the form is not submitted
     59    }
     60
     61    function openTestWindow() {
     62
     63        var user = encodeURIComponent(document.getElementById('AD_Integration_test_user').value);
     64        var password = encodeURIComponent(document.getElementById('AD_Integration_test_password').value);
     65
     66        TestWindow = window.open("<?php echo ( (IS_WPMU) ? WPMU_PLUGIN_URL : WP_PLUGIN_URL ).'/'.ADINTEGRATION_FOLDER;?>/test.php?user=" + user + "&password=" + password, "Test", "width=450,height=500,left=100,top=200");
     67        TestWindow.focus();
     68    }
    5569</script>
    5670
     
    389403                                <input type="checkbox" name="AD_Integration_fallback_to_local_password" id="AD_Integration_fallback_to_local_password"<?php if ($this->_fallback_to_local_password) echo ' checked="checked"' ?> value="1" />
    390404                                <?php _e('Fallback to local (WordPress) password check if authentication against AD fails.</br>If turned on users can logon even if Active Directory server is unreachable. But this might be a security risk (for example, if the local password is outdated). <b>It\'s recommended to turn this off.</b>', 'ad-integration'); ?>
     405                            </td>
     406                        </tr>
     407                       
     408                        <tr valign="top">
     409                            <th scope="row"><label for="AD_Integration_enable_lost_password_recovery"><?php _e('Enable lost password revcovery', 'ad-integration'); ?></label></th>
     410                            <td>
     411                                <input type="checkbox" name="AD_Integration_enable_lost_password_recovery" id="AD_Integration_enable_lost_password_recovery"<?php if ($this->_enable_lost_password_recovery) echo ' checked="checked"' ?> value="1" />
    391412                            </td>
    392413                        </tr>
     
    693714        <!-- TAB: Test -->
    694715        <div id="test">
     716            <!-- <form onsubmit="return submitTestForm();"> -->
    695717            <form onsubmit="window.open('','Test','width=450,height=500,left=100,top=200')" action="<?php echo ( (IS_WPMU) ? WPMU_PLUGIN_URL : WP_PLUGIN_URL ).'/'.ADINTEGRATION_FOLDER;?>/test.php" method="post" target="Test">
    696718                <table class="form-table">
  • active-directory-integration/trunk/readme.txt

    r622590 r665236  
    129129
    130130= 1.1.4 =
     131* ADD: Option to (re-)enable lost password recovery. (Issue #????)
    131132* CHANGE: Only set role of user if the role already exists in WordPress. (Issue #0051)
    132133* CHANGE: Now using POST instead of GET in Test Tool, so user and password are not shown in server log files (Change Request by Aren Cambre. Issue #0054.)
Note: See TracChangeset for help on using the changeset viewer.