add some attributes + email change strategies base classes + interface
This commit is contained in:
@ -31,13 +31,19 @@ class Bootstrap implements BootstrapInterface
|
||||
|
||||
protected function setContainer()
|
||||
{
|
||||
$di = Yii::$container;
|
||||
// helpers
|
||||
Yii::$container->set(AuthHelper::class);
|
||||
$di->set('\Da\User\Helper\AuthHelper');
|
||||
|
||||
// email change strategy
|
||||
$di->set('\Da\User\Strategy\DefaultEmailChangeStrategy');
|
||||
$di->set('\Da\User\Strategy\InsecureEmailChangeStrategy');
|
||||
$di->set('\Da\User\Strategy\SecureEmailChangeStrategy');
|
||||
|
||||
// active query classes
|
||||
Yii::$container->set(AccountQuery::class);
|
||||
Yii::$container->set(ProfileQuery::class);
|
||||
Yii::$container->set(TokenQuery::class);
|
||||
Yii::$container->set(UserQuery::class);
|
||||
Yii::$container->set('\Da\User\Query\AccountQuery');
|
||||
Yii::$container->set('\Da\User\Query\ProfileQuery');
|
||||
Yii::$container->set('\Da\User\Query\TokenQuery');
|
||||
Yii::$container->set('\Da\User\Query\UserQuery');
|
||||
}
|
||||
}
|
||||
|
||||
15
lib/User/Contracts/StrategyInterface.php
Normal file
15
lib/User/Contracts/StrategyInterface.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace Da\User\Contracts;
|
||||
|
||||
/**
|
||||
*
|
||||
* StrategyInterface.php
|
||||
*
|
||||
* Date: 3/12/16
|
||||
* Time: 16:23
|
||||
* @author Antonio Ramirez <hola@2amigos.us>
|
||||
*/
|
||||
interface StrategyInterface
|
||||
{
|
||||
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace Da\User;
|
||||
|
||||
use Da\User\Strategy\DefaultEmailChangeStrategy;
|
||||
|
||||
/**
|
||||
*
|
||||
* Module.php
|
||||
@ -11,11 +13,34 @@ namespace Da\User;
|
||||
*/
|
||||
class Module extends \yii\base\Module
|
||||
{
|
||||
public $token
|
||||
/**
|
||||
* @var bool whether to allow registration process or not.
|
||||
*/
|
||||
public $allowRegistration = true;
|
||||
/**
|
||||
* @var bool whether to force email confirmation to.
|
||||
*/
|
||||
public $forceEmailConfirmation = true;
|
||||
/**
|
||||
* @var bool whether to allow login accounts with unconfirmed emails.
|
||||
*/
|
||||
public $allowUnconfirmedEmailLogin = false;
|
||||
/**
|
||||
* @var string the class name of the strategy class to handle user's email change.
|
||||
*/
|
||||
public $emailChangeStrategy = DefaultEmailChangeStrategy::class;
|
||||
/**
|
||||
* @var int the time user will be auto logged in.
|
||||
*/
|
||||
public $rememberLoginLifespan = 1209600;
|
||||
/**
|
||||
* @var int the time before the confirmation token becomes invalid. Defaults to 24 hours.
|
||||
*/
|
||||
public $tokenConfirmationLifespan = 86400;
|
||||
/**
|
||||
* @var int the time before a recovery token is invalid. Defaults to 6 hours.
|
||||
*/
|
||||
public $tokenRecoveryWithin = 21600;
|
||||
public $tokenRecoveryLifespan = 21600;
|
||||
/**
|
||||
* @var array a list of admin usernames
|
||||
*/
|
||||
|
||||
17
lib/User/Strategy/DefaultEmailChangeStrategy.php
Normal file
17
lib/User/Strategy/DefaultEmailChangeStrategy.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace Da\User\Strategy;
|
||||
|
||||
use Da\User\Contracts\StrategyInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* DefaultEmailChangeStrategy.php
|
||||
*
|
||||
* Date: 3/12/16
|
||||
* Time: 16:22
|
||||
* @author Antonio Ramirez <hola@2amigos.us>
|
||||
*/
|
||||
class DefaultEmailChangeStrategy implements StrategyInterface
|
||||
{
|
||||
|
||||
}
|
||||
17
lib/User/Strategy/InsecureEmailChangeStrategy.php
Normal file
17
lib/User/Strategy/InsecureEmailChangeStrategy.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace Da\User\Strategy;
|
||||
|
||||
use Da\User\Contracts\StrategyInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* InsecuredEmailChangeStrategy.php
|
||||
*
|
||||
* Date: 3/12/16
|
||||
* Time: 16:21
|
||||
* @author Antonio Ramirez <hola@2amigos.us>
|
||||
*/
|
||||
class InsecuredEmailChangeStrategy implements StrategyInterface
|
||||
{
|
||||
|
||||
}
|
||||
17
lib/User/Strategy/SecureEmailChangeStrategy.php
Normal file
17
lib/User/Strategy/SecureEmailChangeStrategy.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace Da\User\Strategy;
|
||||
|
||||
use Da\User\Contracts\StrategyInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
* SecuredEmailChangeStrategy.php
|
||||
*
|
||||
* Date: 3/12/16
|
||||
* Time: 16:20
|
||||
* @author Antonio Ramirez <hola@2amigos.us>
|
||||
*/
|
||||
class SecureEmailChangeStrategy implements StrategyInterface
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user