1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @link https://dukt.net/social/ |
4
|
|
|
* @copyright Copyright (c) Dukt |
5
|
|
|
* @license https://github.com/dukt/social/blob/v2/LICENSE.md |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace dukt\social\models; |
9
|
|
|
|
10
|
|
|
use craft\base\Model; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Settings model class. |
14
|
|
|
* |
15
|
|
|
* @author Dukt <[email protected]> |
16
|
|
|
* @since 2.0 |
17
|
|
|
*/ |
18
|
|
|
class Settings extends Model |
19
|
|
|
{ |
20
|
|
|
// Properties |
21
|
|
|
// ========================================================================= |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var bool Allow email matching |
25
|
|
|
*/ |
26
|
|
|
public $allowEmailMatch = false; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var bool Auto fill profile |
30
|
|
|
*/ |
31
|
|
|
public $autoFillProfile = true; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var int|null Default group |
35
|
|
|
*/ |
36
|
|
|
public $defaultGroup; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var bool Enable social login for the CP |
40
|
|
|
*/ |
41
|
|
|
public $enableCpLogin = false; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var array Enabled login providers |
45
|
|
|
*/ |
46
|
|
|
public $enabledLoginProviders = []; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var bool Enable social login |
50
|
|
|
*/ |
51
|
|
|
public $enableSocialLogin = true; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var bool Enable social registration |
55
|
|
|
*/ |
56
|
|
|
public $enableSocialRegistration = true; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @var array Defines the login providers. |
60
|
|
|
*/ |
61
|
|
|
public $loginProviders = []; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @var array Lock social registration to specific domains |
65
|
|
|
*/ |
66
|
|
|
public $lockDomains = []; |
67
|
|
|
|
68
|
|
|
// Public Methods |
69
|
|
|
// ========================================================================= |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @inheritdoc |
73
|
|
|
*/ |
74
|
|
|
public function rules() |
75
|
|
|
{ |
76
|
|
|
return [ |
77
|
|
|
[['allowEmailMatch', 'autoFillProfile', 'enableCpLogin', 'enableSocialLogin', 'enableSocialRegistration'], 'boolean'], |
78
|
|
|
[['defaultGroup'], 'number', 'integerOnly' => true], |
79
|
|
|
]; |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|