Completed
Push — master ( e4d179...af1c3e )
by Martijn van
02:33
created
code/AdminSecurity.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -91,6 +91,8 @@
 block discarded – undo
91 91
     /**
92 92
      * @see Security::getPasswordResetLink()
93 93
      * We overload this, so we can add the BackURL to the password resetlink
94
+     * @param Member $member
95
+     * @param string $autologinToken
94 96
      */
95 97
     public static function getPasswordResetLink($member, $autologinToken)
96 98
     {
Please login to merge, or discard this patch.
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -6,105 +6,105 @@
 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->owner->getRequest()->getIP(),
34
-                Config::inst()->get('IpAccess', 'allowed_ips'));
35
-            if (!$ipAccess->hasAccess()) {
36
-                $reponse = '';
37
-                if (class_exists('ErrorPage', true)) {
38
-                    $response = ErrorPage::response_for(404);
39
-                }
40
-                return $this->owner->httpError(404, $response ? $response : 'The requested page could not be found.');
41
-            }
42
-        }
32
+		if (Config::inst()->get('IpAccess', 'enabled')) {
33
+			$ipAccess = new IpAccess($this->owner->getRequest()->getIP(),
34
+				Config::inst()->get('IpAccess', 'allowed_ips'));
35
+			if (!$ipAccess->hasAccess()) {
36
+				$reponse = '';
37
+				if (class_exists('ErrorPage', true)) {
38
+					$response = ErrorPage::response_for(404);
39
+				}
40
+				return $this->owner->httpError(404, $response ? $response : 'The requested page could not be found.');
41
+			}
42
+		}
43 43
 
44
-        if (Config::inst()->get('AdminLogin', 'UseTheme') !== true) {
45
-            // this prevents loading frontend css and javscript files
46
-            Object::useCustomClass('Page_Controller', 'AdminLoginPage_Controller');
47
-            Requirements::css('adminlogin/css/style.css');
48
-        }
44
+		if (Config::inst()->get('AdminLogin', 'UseTheme') !== true) {
45
+			// this prevents loading frontend css and javscript files
46
+			Object::useCustomClass('Page_Controller', 'AdminLoginPage_Controller');
47
+			Requirements::css('adminlogin/css/style.css');
48
+		}
49 49
 
50
-        Object::useCustomClass('MemberLoginForm', 'AdminLoginForm');
51
-    }
50
+		Object::useCustomClass('MemberLoginForm', 'AdminLoginForm');
51
+	}
52 52
 
53
-    /**
54
-     * @param null $action
55
-     * @return string
56
-     */
57
-    public function Link($action = null)
58
-    {
59
-        return "AdminSecurity/$action";
60
-    }
53
+	/**
54
+	 * @param null $action
55
+	 * @return string
56
+	 */
57
+	public function Link($action = null)
58
+	{
59
+		return "AdminSecurity/$action";
60
+	}
61 61
 
62
-    /**
63
-     * @return string
64
-     */
65
-    public static function isAdminLogin()
66
-    {
67
-        return strstr(self::getBackUrl(), '/admin/');
68
-    }
62
+	/**
63
+	 * @return string
64
+	 */
65
+	public static function isAdminLogin()
66
+	{
67
+		return strstr(self::getBackUrl(), '/admin/');
68
+	}
69 69
 
70
-    /**
71
-     * @return string
72
-     */
73
-    public static function getBackUrl()
74
-    {
75
-        if (isset($_REQUEST['BackURL'])) {
76
-            return $_REQUEST['BackURL'];
77
-        } elseif (isset($_SESSION['BackURL'])) {
78
-            return $_SESSION['BackURL'];
79
-        }
80
-    }
70
+	/**
71
+	 * @return string
72
+	 */
73
+	public static function getBackUrl()
74
+	{
75
+		if (isset($_REQUEST['BackURL'])) {
76
+			return $_REQUEST['BackURL'];
77
+		} elseif (isset($_SESSION['BackURL'])) {
78
+			return $_SESSION['BackURL'];
79
+		}
80
+	}
81 81
 
82
-    /**
83
-     * @param SS_HTTPRequest $request
84
-     * @return string
85
-     */
86
-    public function passwordsent($request)
87
-    {
88
-        return parent::passwordsent($request);
89
-    }
82
+	/**
83
+	 * @param SS_HTTPRequest $request
84
+	 * @return string
85
+	 */
86
+	public function passwordsent($request)
87
+	{
88
+		return parent::passwordsent($request);
89
+	}
90 90
 
91
-    /**
92
-     * @see Security::getPasswordResetLink()
93
-     * We overload this, so we can add the BackURL to the password resetlink
94
-     */
95
-    public static function getPasswordResetLink($member, $autologinToken)
96
-    {
97
-        $autologinToken      = urldecode($autologinToken);
98
-        $selfControllerClass = __CLASS__;
99
-        $selfController      = new $selfControllerClass();
100
-        return $selfController->Link('changepassword') . "?m={$member->ID}&t=$autologinToken";
101
-    }
91
+	/**
92
+	 * @see Security::getPasswordResetLink()
93
+	 * We overload this, so we can add the BackURL to the password resetlink
94
+	 */
95
+	public static function getPasswordResetLink($member, $autologinToken)
96
+	{
97
+		$autologinToken      = urldecode($autologinToken);
98
+		$selfControllerClass = __CLASS__;
99
+		$selfController      = new $selfControllerClass();
100
+		return $selfController->Link('changepassword') . "?m={$member->ID}&t=$autologinToken";
101
+	}
102 102
 
103
-    /**
104
-     * @return ChangePasswordForm
105
-     */
106
-    public function ChangePasswordForm()
107
-    {
108
-        return new ChangePasswordForm($this, 'ChangePasswordForm');
109
-    }
103
+	/**
104
+	 * @return ChangePasswordForm
105
+	 */
106
+	public function ChangePasswordForm()
107
+	{
108
+		return new ChangePasswordForm($this, 'ChangePasswordForm');
109
+	}
110 110
 }
Please login to merge, or discard this patch.