File tree 3 files changed +20
-7
lines changed
3 files changed +20
-7
lines changed Original file line number Diff line number Diff line change 7
7
* Patrol simplifies maintenance and SSL for sites built with Craft
8
8
*
9
9
* @author Selvin Ortiz <selvin@selvin.co>
10
- * @version 1.4.1
10
+ * @version 1.4.2
11
11
* @package Craft
12
12
* @category Security
13
13
* @since Craft 1.3
@@ -68,7 +68,7 @@ public function getName($real = false)
68
68
*/
69
69
public function getVersion ()
70
70
{
71
- return '1.4.1 ' ;
71
+ return '1.4.2 ' ;
72
72
}
73
73
74
74
/**
Original file line number Diff line number Diff line change 1
1
[
2
+ {
3
+ "version" : " 1.4.2" ,
4
+ "downloadUrl" : " https://github.com/selvinortiz/craft.patrol/archive/v1.4.2.zip" ,
5
+ "date" : " 2017-01-11T13:13:00-06:00" ,
6
+ "notes" : [
7
+ " [Added] Added login (`/{cpTrigger}/login`) redirect when using `limitCpAccessTo`" ,
8
+ " [Fixed] Fixed issue where `authorizedIps` was not properly handled in some cases"
9
+ ]
10
+ },
2
11
{
3
12
"version" : " 1.4.1" ,
4
13
"downloadUrl" : " https://github.com/selvinortiz/craft.patrol/archive/v1.4.1.zip" ,
Original file line number Diff line number Diff line change @@ -145,8 +145,14 @@ protected function enforceMaintenanceRules()
145
145
146
146
if ($ isCpRequest && is_array ($ limitCpAccessTo ) && count ($ limitCpAccessTo ) && ! $ isCpLoginPage )
147
147
{
148
- if (craft ()->userSession ->isLoggedIn ())
148
+ // Redirect to login page
149
+ if (! craft ()->userSession ->isLoggedIn ())
149
150
{
151
+ craft ()->request ->redirect (sprintf ('/%s/login ' , craft ()->config ->get ('cpTrigger ' )));
152
+ }
153
+ else
154
+ {
155
+ // Verify
150
156
$ user = craft ()->userSession ->getUser ();
151
157
152
158
if (in_array ($ user ->email , $ limitCpAccessTo ) || in_array ($ user ->username , $ limitCpAccessTo ))
@@ -250,11 +256,9 @@ protected function getDynamicParams()
250
256
*/
251
257
public function parseAuthorizedIps ($ ips )
252
258
{
253
- $ ips = trim ($ ips );
254
-
255
- if (is_string ($ ips ) && ! empty ($ ips ))
259
+ if (is_string ($ ips ))
256
260
{
257
- $ ips = explode (PHP_EOL , $ ips );
261
+ $ ips = explode (PHP_EOL , trim ( $ ips) );
258
262
}
259
263
260
264
return $ this ->filterOutArrayValues (
You can’t perform that action at this time.
0 commit comments