Completed
Push — master ( 00f01c...c33608 )
by Martijn van
02:27
created
code/AdminSecurity.php 1 patch
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -6,109 +6,109 @@
 block discarded – undo
6 6
  */
7 7
 class AdminSecurity extends Security
8 8
 {
9
-    /**
10
-     * @var array
11
-     */
12
-    private static $allowed_actions = array(
13
-        'passwordsent',
14
-        'ChangePasswordForm'
15
-    );
9
+	/**
10
+	 * @var array
11
+	 */
12
+	private static $allowed_actions = array(
13
+		'passwordsent',
14
+		'ChangePasswordForm'
15
+	);
16 16
 
17
-    /**
18
-     * Template thats used to render the pages.
19
-     *
20
-     * @config
21
-     * @var string
22
-     */
23
-    private static $template_main = 'AdminLogin';
17
+	/**
18
+	 * Template thats used to render the pages.
19
+	 *
20
+	 * @config
21
+	 * @var string
22
+	 */
23
+	private static $template_main = 'AdminLogin';
24 24
 
25
-    /**
26
-     * @return void
27
-     */
28
-    public function init()
29
-    {
30
-        parent::init();
25
+	/**
26
+	 * @return void
27
+	 */
28
+	public function init()
29
+	{
30
+		parent::init();
31 31
 
32
-        if (Config::inst()->get('IpAccess', 'enabled')) {
33
-            $ipAccess = new IpAccess($this->getRequest()->getIP(),
34
-                Config::inst()->get('IpAccess', 'allowed_ips'));
35
-            if (!$ipAccess->hasAccess()) {
36
-                $response = null;
37
-                if (class_exists('ErrorPage', true)) {
38
-                    $response = ErrorPage::response_for(404);
39
-                }
40
-                $this->httpError(404, $response ? $response : 'The requested page could not be found.');
41
-                return;
42
-            }
43
-        }
32
+		if (Config::inst()->get('IpAccess', 'enabled')) {
33
+			$ipAccess = new IpAccess($this->getRequest()->getIP(),
34
+				Config::inst()->get('IpAccess', 'allowed_ips'));
35
+			if (!$ipAccess->hasAccess()) {
36
+				$response = null;
37
+				if (class_exists('ErrorPage', true)) {
38
+					$response = ErrorPage::response_for(404);
39
+				}
40
+				$this->httpError(404, $response ? $response : 'The requested page could not be found.');
41
+				return;
42
+			}
43
+		}
44 44
 
45
-        if (Config::inst()->get('AdminLogin', 'UseTheme') !== true) {
46
-            // this prevents loading frontend css and javscript files
47
-            Object::useCustomClass('Page_Controller', 'AdminLoginPage_Controller');
48
-            Requirements::css('adminlogin/css/style.css');
49
-        }
45
+		if (Config::inst()->get('AdminLogin', 'UseTheme') !== true) {
46
+			// this prevents loading frontend css and javscript files
47
+			Object::useCustomClass('Page_Controller', 'AdminLoginPage_Controller');
48
+			Requirements::css('adminlogin/css/style.css');
49
+		}
50 50
 
51
-        Object::useCustomClass('MemberLoginForm', 'AdminLoginForm');
52
-    }
51
+		Object::useCustomClass('MemberLoginForm', 'AdminLoginForm');
52
+	}
53 53
 
54
-    /**
55
-     * @param null $action
56
-     * @return string
57
-     */
58
-    public function Link($action = null)
59
-    {
60
-        return "AdminSecurity/$action";
61
-    }
54
+	/**
55
+	 * @param null $action
56
+	 * @return string
57
+	 */
58
+	public function Link($action = null)
59
+	{
60
+		return "AdminSecurity/$action";
61
+	}
62 62
 
63
-    /**
64
-     * @return string
65
-     */
66
-    public static function isAdminLogin()
67
-    {
68
-        return strstr(self::getBackUrl(), '/admin/');
69
-    }
63
+	/**
64
+	 * @return string
65
+	 */
66
+	public static function isAdminLogin()
67
+	{
68
+		return strstr(self::getBackUrl(), '/admin/');
69
+	}
70 70
 
71
-    /**
72
-     * @return string
73
-     */
74
-    public static function getBackUrl()
75
-    {
76
-        $request = Controller::curr()->getRequest();
77
-        if ($url = $request->requestVar('BackURL')) {
78
-            return $url;
79
-        }
80
-        return '';
81
-    }
71
+	/**
72
+	 * @return string
73
+	 */
74
+	public static function getBackUrl()
75
+	{
76
+		$request = Controller::curr()->getRequest();
77
+		if ($url = $request->requestVar('BackURL')) {
78
+			return $url;
79
+		}
80
+		return '';
81
+	}
82 82
 
83
-    /**
84
-     * @param SS_HTTPRequest $request
85
-     * @return string
86
-     */
87
-    public function passwordsent($request)
88
-    {
89
-        return parent::passwordsent($request);
90
-    }
83
+	/**
84
+	 * @param SS_HTTPRequest $request
85
+	 * @return string
86
+	 */
87
+	public function passwordsent($request)
88
+	{
89
+		return parent::passwordsent($request);
90
+	}
91 91
 
92
-    /**
93
-     * @see Security::getPasswordResetLink()
94
-     * We overload this, so we can add the BackURL to the password resetlink
95
-     * @param Member $member
96
-     * @param string $autologinToken
97
-     * @return string
98
-     */
99
-    public static function getPasswordResetLink($member, $autologinToken)
100
-    {
101
-        $autologinToken      = urldecode($autologinToken);
102
-        $selfControllerClass = __CLASS__;
103
-        $selfController      = new $selfControllerClass();
104
-        return $selfController->Link('changepassword') . "?m={$member->ID}&t=$autologinToken";
105
-    }
92
+	/**
93
+	 * @see Security::getPasswordResetLink()
94
+	 * We overload this, so we can add the BackURL to the password resetlink
95
+	 * @param Member $member
96
+	 * @param string $autologinToken
97
+	 * @return string
98
+	 */
99
+	public static function getPasswordResetLink($member, $autologinToken)
100
+	{
101
+		$autologinToken      = urldecode($autologinToken);
102
+		$selfControllerClass = __CLASS__;
103
+		$selfController      = new $selfControllerClass();
104
+		return $selfController->Link('changepassword') . "?m={$member->ID}&t=$autologinToken";
105
+	}
106 106
 
107
-    /**
108
-     * @return ChangePasswordForm
109
-     */
110
-    public function ChangePasswordForm()
111
-    {
112
-        return new ChangePasswordForm($this, 'ChangePasswordForm');
113
-    }
107
+	/**
108
+	 * @return ChangePasswordForm
109
+	 */
110
+	public function ChangePasswordForm()
111
+	{
112
+		return new ChangePasswordForm($this, 'ChangePasswordForm');
113
+	}
114 114
 }
Please login to merge, or discard this patch.