Completed
Branch 0.2.1 (e70612)
by Anton
09:15
created

Recover   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5
Metric Value
wmc 5
lcom 1
cbo 5
dl 0
loc 30
rs 10

1 Method

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