-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUserModule.php
56 lines (46 loc) · 1.24 KB
/
UserModule.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace mavs1971\user;
use abhimanyu\installer\helpers\enums\Configuration as Enum;
use Yii;
use yii\base\Module;
use yii\i18n\PhpMessageSource;
class UserModule extends Module
{
/**
* Module Version
*/
const VERSION = '0.0.4';
/**
* @var bool Checks whether the user can register
*/
public static $canRegister = 0;
/**
* @var bool Checks whether the user can recover password
*/
public static $canRecoverPassword = 0;
/**
* @var int Stores remember me duration in seconds
*/
public static $rememberMeDuration = 0;
/**
* @var int Login Type
*/
public static $loginType = 0;
public function init()
{
UserModule::$canRegister = Yii::$app->config->get(Enum::USER_REGISTRATION, 1);
UserModule::$canRecoverPassword = Yii::$app->config->get(Enum::USER_FORGOT_PASSWORD, 1);
UserModule::$rememberMeDuration = Yii::$app->config->get(Enum::REMEMBER_ME_DURATION, 1);
UserModule::$loginType = Yii::$app->config->get(Enum::USER_LOGIN_TYPE, 0);
$this->setAliases(['@user' => __DIR__]);
parent::init();
$this->registerTranslations();
}
public function registerTranslations()
{
Yii::$app->i18n->translations['user*'] = [
'class' => PhpMessageSource::className(),
'basePath' => __DIR__ . '/messages',
];
}
}