Passed
Pull Request — master (#11)
by Anton
03:24
created

Recover   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 5
dl 0
loc 32
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B handle() 0 27 6
1
<?php
2
3
namespace Modules\Auth\Action {
4
5
	use Modules\Auth, Request;
6
7
	class Recover extends Auth\Utils\Action {
8
9
		# Handle request
10
11
		public function handle() {
12
13
			# Init user by secret code
14
15
			if (false !== ($code = Auth::secret())) $this->code = $code;
16
17
			else Request::redirect(INSTALL_PATH . (Auth::admin() ? '/admin' : '/profile') . '/reset');
18
19
			# Set view
20
21
			$this->view = (Auth::admin() ? 'Blocks/Auth/Recover' : 'Blocks/Profile/Auth/Recover');
22
23
			# Create form
24
25
			$this->form = new Auth\Form\Recover;
26
27
			# Handle form
28
29
			if ($this->form->handle(new Auth\Controller\Recover)) {
30
31
				Request::redirect(INSTALL_PATH . (Auth::admin() ? '/admin' : '/profile') . '/login?submitted=recover');
32
			}
33
34
			# ------------------------
35
36
			return $this->getContents();
37
		}
38
	}
39
}
40