function register if this- dx_auth- is_logged_in this- dx_auth- allow_

 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
function register()
{
if ( ! $this->dx_auth->is_logged_in()
&& $this->dx_auth->allow_registration)
{
// правила для формы
$this->form_validation->set_rules('username',
$this->lang->line('auth_form_username'),
'trim|required|xss_clean|min_length['
. $this->config->item('auth_username_min_length')
. ']|max_length['
. $this->config->item('auth_username_max_length')
. ']|callback__username_check|alpha_dash');
$this->form_validation->set_rules('password',
$this->lang->line('auth_form_password'),
'trim|required|xss_clean|min_length['
. $this->config->item('auth_password_min')
. ']|max_length['
. $this->config->item('auth_password_max')
. ']|matches[confirm_password]');
$this->form_validation->set_rules('confirm_password',
$this->lang->line('auth_form_confirm_password'),
'trim|required|xss_clean');
$this->form_validation->set_rules('email',
$this->config->item('auth_form_email'),
'trim|required|xss_clean|valid_email|callback__email_check');
// регистрируем пользователя, если данные правильные
if ($val->run() &&
$this->dx_auth->register(
$this->input->post('username'),
$this->input->post('password'),
$this->input->post('email')
)
)
{
// сообщение для успешно зарегенного пользователя
$data['auth_message'] = $this->lang->line('auth_msg_you_will_recieve_activation_email');
//передача в вид
$this->load->view('auth/register/success', $data);
}
else
{
// если не получилось или в первый раз, то снова страница регистрации
$this->load->view('auth/register/main');
}
}
elseif ( ! $this->dx_auth->allow_registration)
{
$data['auth_message'] = $this->lang->line('auth_error_registration_is_disabled');
$this->load->view('auth/error', $data);
}
else
{
$data['auth_message'] = $this->lang->line('auth_you_have_to_logout_before_registering');
$this->load->view('auth/register/need_logout', $data);
}
}