Skip to content

Commit

Permalink
Merged from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
rochamarcelo committed Nov 16, 2018
1 parent 64ddb07 commit 07fe07d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Controller/Traits/UserValidationTrait.php
Expand Up @@ -11,12 +11,12 @@

namespace CakeDC\Users\Controller\Traits;

use CakeDC\Users\Controller\Component\UsersAuthComponent;
use CakeDC\Users\Exception\TokenExpiredException;
use CakeDC\Users\Exception\UserAlreadyActiveException;
use CakeDC\Users\Exception\UserNotFoundException;
use Cake\Core\Configure;
use Cake\Http\Response;
use CakeDC\Users\Plugin;
use Exception;

/**
Expand Down Expand Up @@ -69,7 +69,7 @@ public function validate($type = null, $token = null)
} catch (UserNotFoundException $ex) {
$this->Flash->error(__d('CakeDC/Users', 'Invalid token or user account already validated'));
} catch (TokenExpiredException $ex) {
$event = $this->dispatchEvent(UsersAuthComponent::EVENT_ON_EXPIRED_TOKEN, ['type' => $type]);
$event = $this->dispatchEvent(Plugin::EVENT_ON_EXPIRED_TOKEN, ['type' => $type]);
if (!empty($event) && is_array($event->result)) {
return $this->redirect($event->result);
}
Expand Down Expand Up @@ -99,7 +99,7 @@ public function resendTokenValidation()
'sendEmail' => true,
'type' => 'email'
])) {
$event = $this->dispatchEvent(UsersAuthComponent::EVENT_AFTER_RESEND_TOKEN_VALIDATION);
$event = $this->dispatchEvent(Plugin::EVENT_AFTER_RESEND_TOKEN_VALIDATION);
if (!empty($event) && is_array($event->result)) {
return $this->redirect($event->result);
}
Expand Down
3 changes: 3 additions & 0 deletions src/Plugin.php
Expand Up @@ -36,6 +36,9 @@ class Plugin extends BasePlugin implements AuthenticationServiceProviderInterfac
const EVENT_AFTER_REGISTER = 'Users.Managment.afterRegister';
const EVENT_AFTER_CHANGE_PASSWORD = 'Users.Managment.afterResetPassword';
const EVENT_BEFORE_SOCIAL_LOGIN_USER_CREATE = 'Users.Managment.beforeSocialLoginUserCreate';
const EVENT_ON_EXPIRED_TOKEN = 'Users.Managment.onExpiredToken';
const EVENT_AFTER_RESEND_TOKEN_VALIDATION = 'Users.Managment.afterResendTokenValidation';


/**
* Returns an authentication service instance.
Expand Down
1 change: 0 additions & 1 deletion tests/TestCase/Controller/Traits/LoginTraitTest.php
Expand Up @@ -20,7 +20,6 @@
use CakeDC\Users\Authenticator\FormAuthenticator;
use CakeDC\Users\Authenticator\SocialAuthenticator;
use CakeDC\Users\Controller\Component\LoginComponent;
use CakeDC\Users\Controller\Component\UsersAuthComponent;
use CakeDC\Users\Middleware\SocialAuthMiddleware;
use Cake\Event\Event;
use Cake\Http\ServerRequest;
Expand Down
Expand Up @@ -12,7 +12,6 @@
namespace CakeDC\Users\Test\TestCase\Controller\Traits;

use CakeDC\Users\Controller\Component\OneTimePasswordAuthenticatorComponent;
use CakeDC\Users\Controller\Component\UsersAuthComponent;
use CakeDC\Users\Controller\Traits\OneTimePasswordVerifyTrait;
use Cake\Core\Configure;
use Cake\Http\ServerRequest;
Expand Down

0 comments on commit 07fe07d

Please sign in to comment.