Completed
Push — master ( 0600bf...4962bf )
by Martijn van
02:29
created
code/AdminLoginForm.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -3,73 +3,73 @@
 block discarded – undo
3 3
 class AdminLoginForm extends MemberLoginForm
4 4
 {
5 5
 
6
-    public function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true)
7
-    {
8
-        parent::__construct($controller, $name, $fields, $actions, $checkCurrentUser);
6
+	public function __construct($controller, $name, $fields = null, $actions = null, $checkCurrentUser = true)
7
+	{
8
+		parent::__construct($controller, $name, $fields, $actions, $checkCurrentUser);
9 9
 
10
-        if ($this->Actions()->fieldByName('forgotPassword')) {
11
-            // replaceField won't work, since it's a dataless field
12
-            $this->Actions()->removeByName('forgotPassword');
13
-            $this->Actions()->push(new LiteralField(
14
-                'forgotPassword',
15
-                '<p id="ForgotPassword"><a href="AdminSecurity/lostpassword">'
16
-                . _t('Member.BUTTONLOSTPASSWORD', "I've lost my password") . '</a></p>'
17
-            ));
18
-        }
10
+		if ($this->Actions()->fieldByName('forgotPassword')) {
11
+			// replaceField won't work, since it's a dataless field
12
+			$this->Actions()->removeByName('forgotPassword');
13
+			$this->Actions()->push(new LiteralField(
14
+				'forgotPassword',
15
+				'<p id="ForgotPassword"><a href="AdminSecurity/lostpassword">'
16
+				. _t('Member.BUTTONLOSTPASSWORD', "I've lost my password") . '</a></p>'
17
+			));
18
+		}
19 19
 
20
-        Requirements::customScript(<<<JS
20
+		Requirements::customScript(<<<JS
21 21
 			(function() {
22 22
 				var el = document.getElementById("AdminLoginForm_LoginForm_Email");
23 23
 				if(el && el.focus) el.focus();
24 24
 			})();
25 25
 JS
26
-        );
27
-    }
26
+		);
27
+	}
28 28
 
29
-    /**
30
-     * @param array $data
31
-     */
32
-    public function forgotPassword($data)
33
-    {
34
-        $email = Convert::raw2sql($data['Email']);
29
+	/**
30
+	 * @param array $data
31
+	 */
32
+	public function forgotPassword($data)
33
+	{
34
+		$email = Convert::raw2sql($data['Email']);
35 35
 
36
-        /* @var $member Member */
37
-        $member = Member::get()->where("Email = '{$email}'")->first();
36
+		/* @var $member Member */
37
+		$member = Member::get()->where("Email = '{$email}'")->first();
38 38
 
39
-        if ($member) {
40
-            $token = $member->generateAutologinTokenAndStoreHash();
39
+		if ($member) {
40
+			$token = $member->generateAutologinTokenAndStoreHash();
41 41
 
42
-            $this->sendPasswordResetLinkEmail($member, $token);
42
+			$this->sendPasswordResetLinkEmail($member, $token);
43 43
 
44
-            $this->controller->redirect('AdminSecurity/passwordsent/' . urlencode($data['Email']));
45
-        } elseif ($data['Email']) {
46
-            // Avoid information disclosure by displaying the same status,
47
-            // regardless wether the email address actually exists
48
-            $this->controller->redirect('AdminSecurity/passwordsent/' . urlencode($data['Email']));
49
-        } else {
50
-            $this->sessionMessage(
51
-                _t('Member.ENTEREMAIL', 'Please enter an email address to get a password reset link.'),
52
-                'bad'
53
-            );
44
+			$this->controller->redirect('AdminSecurity/passwordsent/' . urlencode($data['Email']));
45
+		} elseif ($data['Email']) {
46
+			// Avoid information disclosure by displaying the same status,
47
+			// regardless wether the email address actually exists
48
+			$this->controller->redirect('AdminSecurity/passwordsent/' . urlencode($data['Email']));
49
+		} else {
50
+			$this->sessionMessage(
51
+				_t('Member.ENTEREMAIL', 'Please enter an email address to get a password reset link.'),
52
+				'bad'
53
+			);
54 54
 
55
-            $this->controller->redirect('AdminSecurity/lostpassword');
56
-        }
57
-    }
55
+			$this->controller->redirect('AdminSecurity/lostpassword');
56
+		}
57
+	}
58 58
 
59
-    /**
60
-     * @param $member
61
-     * @param $token
62
-     */
63
-    protected function sendPasswordResetLinkEmail($member, $token)
64
-    {
65
-        /* @var $email Member_ForgotPasswordEmail */
66
-        $email = Member_ForgotPasswordEmail::create();
67
-        $email->populateTemplate($member);
68
-        $email->populateTemplate(array(
69
-            'PasswordResetLink' => AdminSecurity::getPasswordResetLink($member, $token)
70
-        ));
71
-        $email->setTo($member->Email);
72
-        $email->send();
73
-    }
59
+	/**
60
+	 * @param $member
61
+	 * @param $token
62
+	 */
63
+	protected function sendPasswordResetLinkEmail($member, $token)
64
+	{
65
+		/* @var $email Member_ForgotPasswordEmail */
66
+		$email = Member_ForgotPasswordEmail::create();
67
+		$email->populateTemplate($member);
68
+		$email->populateTemplate(array(
69
+			'PasswordResetLink' => AdminSecurity::getPasswordResetLink($member, $token)
70
+		));
71
+		$email->setTo($member->Email);
72
+		$email->send();
73
+	}
74 74
 
75 75
 }
Please login to merge, or discard this patch.