-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModule.php
More file actions
112 lines (80 loc) · 3.45 KB
/
Copy pathModule.php
File metadata and controls
112 lines (80 loc) · 3.45 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
namespace dimple\administrator;
use Yii;
use yii\i18n\PhpMessageSource;
class Module extends \yii\base\Module
{
public $controllerNamespace = 'dimple\administrator\controllers';
const VERSION = '0.5.0';
/** Email is changed right after user enter's new email address. */
const STRATEGY_INSECURE = 0;
/** Email is changed after user clicks confirmation link sent to his new email address. */
const STRATEGY_DEFAULT = 1;
/** Email is changed after user clicks both confirmation links sent to his old and new email addresses. */
const STRATEGY_SECURE = 2;
/** @var bool Whether to enable registration. */
public $enableRegistration = true;
/** @var bool Whether to remove password field from registration form. */
public $enableGeneratingPassword = false;
/** @var bool Whether user has to confirm his account. */
public $enableConfirmation = true;
/** @var bool Whether to allow logging in without confirmation. */
public $enableUnconfirmedLogin = false;
/** @var bool Whether to enable password recovery. */
public $enablePasswordRecovery = true;
/** @var integer Email changing strategy. */
public $emailChangeStrategy = self::STRATEGY_DEFAULT;
/** @var int The time you want the user will be remembered without asking for credentials. */
public $rememberFor = 1209600; // two weeks
/** @var int The time before a confirmation token becomes invalid. */
public $confirmWithin = 86400; // 24 hours
/** @var int The time before a recovery token becomes invalid. */
public $recoverWithin = 21600; // 6 hours
/** @var int Cost parameter used by the Blowfish hash algorithm. */
public $cost = 10;
/** @var array An array of administrator's usernames. */
public $admins = [];
/** @var array Mailer configuration */
public $mailer = [];
/** @var array Model map */
public $modelMap = [];
public $confirmUrl;
public $recoveryUrl;
public $layout = 'main';
/**
* @var string The prefix for user module URL.
* @See [[GroupUrlRule::prefix]]
*/
public $urlPrefix = 'administrator';
public function init()
{
parent::init();
Yii::configure($this, require(__DIR__ . '/config.php'));
$this->registerTranslations();
$this->setDefaultMessageMailer();
$this->modules = [
// 'admin' => [
// // you should consider using a shorter namespace here!
// 'class' => 'app\modules\forum\modules\admin\Module',
// ],
];
}
public function registerTranslations()
{
if(!isset(Yii::$app->i18n->translations['user*'])) {
Yii::$app->i18n->translations['user*'] = [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => __DIR__ . '/messages'
];
}
}
public function setDefaultMessageMailer(){
$defaults = [
'welcomeSubject' => \Yii::t('user', 'Welcome to {0}', \Yii::$app->name),
'confirmationSubject' => \Yii::t('user', 'Confirm account on {0}', \Yii::$app->name),
'reconfirmationSubject' => \Yii::t('user', 'Confirm email change on {0}', \Yii::$app->name),
'recoverySubject' => \Yii::t('user', 'Complete password reset on {0}', \Yii::$app->name)
];
Yii::$container->set('dimple\administrator\Mailer', array_merge($defaults, $this->mailer));
}
}