|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Ubiquity\controllers\auth; |
|
4
|
|
|
|
|
5
|
|
|
use Ubiquity\utils\flash\FlashMessage; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* |
|
9
|
|
|
* Ubiquity\controllers\auth$AuthControllerVariablesTrait |
|
10
|
|
|
* This class is part of Ubiquity |
|
11
|
|
|
* @author jc |
|
12
|
|
|
* @version 1.0.0 |
|
13
|
|
|
* |
|
14
|
|
|
*/ |
|
15
|
|
|
trait AuthControllerVariablesTrait { |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Override for modifying the noAccess message |
|
19
|
|
|
* |
|
20
|
|
|
* @param FlashMessage $fMessage |
|
21
|
|
|
*/ |
|
22
|
|
|
protected function noAccessMessage(FlashMessage $fMessage) { |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Override for modifying attempts message |
|
27
|
|
|
* You can use {_timer} and {_attemptsCount} variables in message content |
|
28
|
|
|
* |
|
29
|
|
|
* @param FlashMessage $fMessage |
|
30
|
|
|
* @param int $attempsCount |
|
31
|
|
|
*/ |
|
32
|
|
|
protected function attemptsNumberMessage(FlashMessage $fMessage, $attempsCount) { |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* To override for modifying the bad login message |
|
37
|
|
|
* |
|
38
|
|
|
* @param FlashMessage $fMessage |
|
39
|
|
|
*/ |
|
40
|
|
|
protected function badLoginMessage(FlashMessage $fMessage) { |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* To override for modifying the logout message |
|
45
|
|
|
* |
|
46
|
|
|
* @param FlashMessage $fMessage |
|
47
|
|
|
*/ |
|
48
|
|
|
protected function terminateMessage(FlashMessage $fMessage) { |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* To override for modifying the disconnect message |
|
53
|
|
|
* |
|
54
|
|
|
* @param FlashMessage $fMessage |
|
55
|
|
|
*/ |
|
56
|
|
|
protected function disconnectedMessage(FlashMessage $fMessage) { |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* To override |
|
61
|
|
|
* Returns int the maximum number of allowed login attempts. |
|
62
|
|
|
*/ |
|
63
|
1 |
|
protected function attemptsNumber() { |
|
64
|
1 |
|
return; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* To override |
|
69
|
|
|
* Returns the time before trying to connect again |
|
70
|
|
|
* Effective only if attemptsNumber return a number. |
|
71
|
|
|
* |
|
72
|
|
|
* @return int |
|
73
|
|
|
*/ |
|
74
|
|
|
protected function attemptsTimeout():int { |
|
75
|
|
|
return 3 * 60; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Override to define if user info is displayed as string. |
|
80
|
|
|
* If set to true, use {{ _infoUser| raw }} in views to display user info. |
|
81
|
|
|
* Remember to use $this->jquery->renderView instead of $this->loadView for the javascript generation. |
|
82
|
|
|
*/ |
|
83
|
1 |
|
public function _displayInfoAsString(): bool { |
|
84
|
1 |
|
return false; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* To override for defining user session key, default : "activeUser" |
|
89
|
|
|
* @return string |
|
90
|
|
|
*/ |
|
91
|
1 |
|
public function _getUserSessionKey():string { |
|
92
|
1 |
|
return 'activeUser'; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
1 |
|
public function _checkConnectionTimeout() { |
|
96
|
1 |
|
return; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
public function _getLoginInputName(): string { |
|
100
|
|
|
return 'email'; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
1 |
|
protected function loginLabel():string { |
|
104
|
1 |
|
return \ucfirst ( $this->_getLoginInputName () ); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
1 |
|
public function _getPasswordInputName():string { |
|
108
|
1 |
|
return 'password'; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
1 |
|
protected function passwordLabel(): string { |
|
112
|
1 |
|
return \ucfirst ( $this->_getPasswordInputName () ); |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
protected function passwordConfLabel(): string { |
|
116
|
|
|
return \ucfirst ( $this->_getPasswordInputName () ).' confirmation'; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* Returns the body selector (jquery selector used for replacing the content of the page). |
|
121
|
|
|
* default: main .container |
|
122
|
|
|
* |
|
123
|
|
|
* @return string |
|
124
|
|
|
*/ |
|
125
|
1 |
|
public function _getBodySelector():string { |
|
126
|
1 |
|
return 'main .container'; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
1 |
|
protected function rememberCaption():string { |
|
130
|
1 |
|
return 'Remember me'; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
|