-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.php
More file actions
150 lines (128 loc) · 3.83 KB
/
Copy pathindex.php
File metadata and controls
150 lines (128 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
class Feather_Core_Index_Controller extends Feather_Base_Controller {
/**
* Feather's Homepage. This overview page consists of a all the root level places
* plus some sub-places, a select number of discussions for each place is shown.
*
* @return void
*/
public function get_index()
{
$places = Feather\Core\Place::index($this->config->get('feather: db.overview.discussions_per_place'));
$this->layout->nest('content', 'feather core::index.home', compact('places'));
}
/**
* Allows a user to enter their login details into a form and then become
* authenticated on the forums.
*
* @return void
*/
public function get_login()
{
if($this->auth->online())
{
return $this->redirect->to_route('feather');
}
elseif($this->config->get('feather: db.auth.driver', 'internal') != 'internal')
{
return $this->redirect->before_login();
}
$this->breadcrumbs->drop(__('feather core::titles.login'));
$this->layout->with('title', __('feather core::titles.login'))
->nest('content', 'feather core::user.login');
}
/**
* Handles the posting of the login form and after validation, attempts to
* authenticate the user.
*
* @return void
*/
public function post_login()
{
try
{
$this->validator->get('auth.login')->against(Input::get())->passes();
}
catch (FeatherValidationException $errors)
{
return $this->redirect->with_query('route: login')->with_input()->with_errors($errors->get());
}
if($this->auth->attempt(Input::get()))
{
return $this->redirect->to_previous('route: feather');
}
return $this->redirect->to_self()->with_input()->alert('error', 'feather core::login.failure');
}
/**
* Logs a user out of the forums and redirects them back to where they were, or depending
* on the authentication driver, a logout landing page.
*
* @return void
*/
public function get_logout()
{
$this->auth->logout();
// Return to the generated logout URL, this can change depending on the authentication
// driver that is being used.
return $this->redirect->after_logout();
}
/**
* If registrations are enabled a user can enter the required details into the registration
* form and register an account on the forums.
*
* @return void
*/
public function get_register()
{
if($this->config->get('feather: db.auth.driver', 'internal') != 'internal')
{
return $this->redirect->before_register();
}
$this->breadcrumbs->drop(__('feather core::titles.register'));
$this->layout->with('title', __('feather core::titles.register'))
->nest('content', 'feather core::user.register');
}
/**
* Handles the posting of the registration form. Validates and then attempts to
* register a user with the details they supplied. If e-mail activation is enabled
* a user will also be sent an e-mail so they can activate their account.
*
* @return void
*/
public function post_register()
{
try
{
$this->validator->get('auth.register')->against(Input::get())->passes();
}
catch (FeatherValidationException $errors)
{
return $this->redirect->to_self()->with_input()->with_errors($errors->get());
}
try
{
$user = Feather\Core\User::register(Input::get());
}
catch (FeatherModelException $errors)
{
return $this->redirect->to_self()->with_input()->alert('error', 'feather core::register.failure');
}
// Users must confirm their e-mail address once they have registered. We
// will now send them an e-mail with their activation code.
if($this->config->get('feather: db.registration.confirm_email'))
{
}
$this->auth->login($user);
return $this->redirect->to_previous('route: feather');
}
/**
* Simply shows the forums rules.
*
* @return void
*/
public function get_rules()
{
$this->layout->with('title', __('feather core::titles.rules'))
->nest('content', 'feather core::misc.rules');
}
}