Cakephp 2.x User Management Premium Plugin Version 2.3

Plugin Bug Fixes & Migration

Bug Fixes and Improvement Table

From Version To Version Changes Date Links
2.3.3 2.3.4 8-Oct-2015  View
2.3.4 2.3.5 27-Nov-2016  View

Plugin Version- 2.3.3 to 2.3.4

Date: 08-Oct-2015

Please keep backup of your code before replacing the files. Either you can replace existing files or do changes in existing code as per new changes.

You can download the old version 2.3.3 and make a difference with your application code using Kdiff3 software http://kdiff3.sourceforge.net/ and record your changes done in plugin files.

1. Open app\Plugin\Usermgmt\Controller\UserContactsController.php

Go to contactUs function
Replace 'recaptcha_response_field' with 'g-recaptcha-response'

2. Open app\Plugin\Usermgmt\Controller\UsersController.php

Go to login function
Replace 'recaptcha_response_field' with 'g-recaptcha-response'

Go to register function
Replace 'recaptcha_response_field' with 'g-recaptcha-response'

Go to forgotPassword function
Replace 'recaptcha_response_field' with 'g-recaptcha-response'

Go to emailVerification function
Replace 'recaptcha_response_field' with 'g-recaptcha-response'

3. Open app\Plugin\Usermgmt\Controller\Component\UserAuthComponent.php

Go to beforeFilter function

replace
if (!in_array($actionUrl, $allControllers)) {
    $errorPage=true;
}
with
if (!in_array(strtolower($actionUrl), array_map('strtolower', $allControllers))) {

    $errorPage=true;
}

4. Open app\Plugin\Usermgmt\Model\LoginToken.php

replace
App::uses('AppModel', 'Model');
with
App::uses('UserMgmtAppModel', 'Usermgmt.Model');

replace
class LoginToken extends AppModel
with
class LoginToken extends UserMgmtAppModel

5. Open app\Plugin\Usermgmt\Model\User.php

Go to recaptchaValidate function and replace function with following code
public function recaptchaValidate() {
    App::import("Vendor", "Usermgmt.recaptcha/src/autoload");
    $recaptcha = new \ReCaptcha\ReCaptcha(PRIVATE_KEY_FROM_RECAPTCHA);
    $value = (isset($_POST['g-recaptcha-response'])) ? $_POST['g-recaptcha-response'] : "";
    if(!empty($value)) {
        $resp = $recaptcha->verify($value);
        if(!$resp->isSuccess()) {
            $errors = $resp->getErrorCodes();
            $this->validationErrors['captcha'][0] = __('Prove you are not a robot');
        }
    } else {
        $this->validationErrors['captcha'][0] = __('Please select I\'m not a robot');
    }
    return true;
}

6. Open app\Plugin\Usermgmt\Model\UserContact.php

Go to recaptchaValidate function and replace function with following code
public function recaptchaValidate() {
    App::import("Vendor", "Usermgmt.recaptcha/src/autoload");
    $recaptcha = new \ReCaptcha\ReCaptcha(PRIVATE_KEY_FROM_RECAPTCHA);
    $value = (isset($_POST['g-recaptcha-response'])) ? $_POST['g-recaptcha-response'] : "";
    if(!empty($value)) {
        $resp = $recaptcha->verify($value);
        if(!$resp->isSuccess()) {
            $errors = $resp->getErrorCodes();
            $this->validationErrors['captcha'][0] = __('Prove you are not a robot');
        }
    } else {
        $this->validationErrors['captcha'][0] = __('Please select I\'m not a robot');
    }
    return true;
}

7. Open app\Plugin\Usermgmt\Model\UserEmail.php

replace
App::uses('AppModel', 'Model');
with
App::uses('UserMgmtAppModel', 'Usermgmt.Model');

replace
class UserEmail extends AppModel
with
class UserEmail extends UserMgmtAppModel

8. Open app\Plugin\Usermgmt\Model\UserEmailRecipient.php

replace
App::uses('AppModel', 'Model');
with
App::uses('UserMgmtAppModel', 'Usermgmt.Model');

replace
class UserEmailRecipient extends AppModel
with
class UserEmailRecipient extends UserMgmtAppModel

9. Open app\Plugin\Usermgmt\Model\UserMgmtAppModel.php

Add following fuction
/**
 * Used to validate not empty
 *
 * @access public
 * @return boolean
 */
public function notEmpty($check) {
    $value = array_values($check);
    $value = $value[0];
    if(method_exists(new Validation(), 'notBlank')) {
        return Validation::notBlank($value);
    } else {
        return Validation::notEmpty($value);
    }
}

10. Replace all files of app\Plugin\Usermgmt\Vendor\recaptcha

11. Open app\Plugin\Usermgmt\View\Elements\contact_us.ctp

remove these lines
$this->Form->unlockField('recaptcha_challenge_field');
$this->Form->unlockField('recaptcha_response_field');

12. Open app\Plugin\Usermgmt\View\Elements\login.ctp

remove these lines
$this->Form->unlockField('recaptcha_challenge_field');
$this->Form->unlockField('recaptcha_response_field');

13. Replace app\Plugin\Usermgmt\View\Elements\paginator.ctp

14. Replace app\Plugin\Usermgmt\View\Elements\search_form.ctp

15. Open app\Plugin\Usermgmt\View\Helper\UserAuthHelper.php

replace
var $helpers = array('Session');
with
var $helpers = array('Session', 'Html', 'Form');

add var $recaptcha_script = false; after var $permissions = array();

Go to showCaptcha function and replace it with following code
public function showCaptcha($error=null) {
    $this->Form->unlockField('g-recaptcha-response');
    if(!$this->recaptcha_script) {
        $this->recaptcha_script = true;
        $this->Html->script('https://www.google.com/recaptcha/api.js', array('inline'=>false));
    }
    $code = '<div class="g-recaptcha" data-sitekey="'.PUBLIC_KEY_FROM_RECAPTCHA.'"></div>';
    $errorMsg = '';
    if(!empty($error)) {
        $errorMsg = "<div class='error-message'>".$error."</div>";
    }
    return $code.$errorMsg;
}

16. Open app\Plugin\Usermgmt\View\Users\email_verification.ctp

remove these lines
$this->Form->unlockField('recaptcha_challenge_field');
$this->Form->unlockField('recaptcha_response_field');

17. Open app\Plugin\Usermgmt\View\Users\forgot_password.ctp

remove these lines
$this->Form->unlockField('recaptcha_challenge_field');
$this->Form->unlockField('recaptcha_response_field');

18. Open app\Plugin\Usermgmt\View\Users\login.ctp

remove these lines
$this->Form->unlockField('recaptcha_challenge_field');
$this->Form->unlockField('recaptcha_response_field');

19. Open app\Plugin\Usermgmt\View\Users\register.ctp

remove these lines
$this->Form->unlockField('recaptcha_challenge_field');
$this->Form->unlockField('recaptcha_response_field');

 

Plugin Version- 2.3.4 to 2.3.5

Date: 27-Nov-2016

Please keep backup of your code before replacing the files. Either you can replace existing files or do changes in existing code as per new changes.

You can download the old version 2.3.4 and make a difference with your application code using Kdiff3 software http://kdiff3.sourceforge.net/ and record your changes done in plugin files.

1. Open app\Plugin\Usermgmt\Controller\Component\UserAuthComponent.php

Go to __useCookieToken function
Replace 'split' with 'explode'

2. Open app\Plugin\Usermgmt\Controller\UsersController.php

Go to deleteCache function

Add following line
$this->UserActivity->query('TRUNCATE TABLE user_activities');
after
$this->UserSetting->updateAll(array('UserSetting.value'=>'UserSetting.value + 1'), array('UserSetting.name'=>'QRDN'));

3. Open app\Plugin\Usermgmt\Model\User.php

Go to authsomeLogin function
Replace 'split' with 'explode'

4. Replace all files of app\Plugin\Usermgmt\Vendor\recaptcha

5. Open app\Plugin\Usermgmt\View\UserEmails\send_confirm.ctp

replace
<?php echo $this->Form->create('UserEmail', array('action'=>'send/confirm', 'onSubmit'=>'return validateForm()')); ?>
with
<?php echo $this->Form->create('UserEmail', array('url'=>array('action'=>'send/confirm'), 'onSubmit'=>'return validateForm()')); ?>

6. Open app\Plugin\Usermgmt\View\UserEmails\send_reply_confirm.ctp

replace
<?php echo $this->Form->create('UserEmail', array('action'=>'sendReply/'.$userContactId.'/confirm', 'onSubmit'=>'return validateForm()')); ?>
with
<?php echo $this->Form->create('UserEmail', array('url'=>array('action'=>'sendReply/'.$userContactId.'/confirm'), 'onSubmit'=>'return validateForm()')); ?>

7. Open app\Plugin\Usermgmt\View\UserEmails\send_to_user_confirm.ctp

replace
<?php echo $this->Form->create('UserEmail', array('action'=>'sendToUser/'.$userId.'/confirm', 'onSubmit'=>'return validateForm()')); ?>
with
<?php echo $this->Form->create('UserEmail', array('url'=>array('action'=>'sendToUser/'.$userId.'/confirm'), 'onSubmit'=>'return validateForm()')); ?>

8. Open app\Plugin\Usermgmt\webroot\js\ajaxValidation.js

replace
var selec = this.settings.element.selector;
with
var selec = '#'+this.settings.element.attr('id');
at 2 places