00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 class UserBaseController extends ControllerBase {
00013 const ALLOW_REGISTER = 1;
00014 const ALLOW_LOST_PASSWORD = 2;
00015 const ALLOW_RESEND_REGISTRATION = 4;
00016 const ALLOW_LOGIN = 8;
00017 const SUPPORT_DASHBOARD = 16;
00018
00019
00020
00021
00022 const SUPPORT_CONFIRM_DATA = 32;
00023
00024
00025
00026 const SUPPORT_TOS = 64;
00027
00028 const ALL_FEATURES = 255;
00029
00030
00031
00032
00033
00034
00035 protected $dashboards = null;
00036
00037
00038
00039
00040 public function get_routes() {
00041 $ret = array(
00042 'logout' => new ExactMatchRoute('https://logout', $this, 'logout', new NoCacheCacheManager()),
00043 'edit_self' => new ExactMatchRoute('https://user/edit', $this, 'users_edit_self', new AccessRenderDecorator()),
00044 'delete_account' => new ExactMatchRoute('https://user/delete_account', $this, 'users_delete_account', new AccessRenderDecorator()),
00045 'create' => new ExactMatchRoute('https://user/create', $this, 'users_create', new AccessRenderDecorator(USER_ROLE_ADMIN)),
00046 'edit' => new ParameterizedRoute('https://user/{id:ui>}/edit', $this, 'users_edit', new AccessRenderDecorator(USER_ROLE_ADMIN)),
00047 'list_all' => new ExactMatchRoute('https://user/list', $this, 'users_list_all', new AccessRenderDecorator(USER_ROLE_ADMIN)),
00048 'list_confirmations' => new ExactMatchRoute('https://user/confirmations', $this, 'users_list_confirmations', new AccessRenderDecorator(USER_ROLE_ADMIN)),
00049 );
00050 if ($this->has_feature(self::ALLOW_LOGIN)) {
00051 $ret['login'] = new ExactMatchRoute('https://login', $this, 'login', new NoCacheCacheManager());
00052 }
00053 if ($this->has_feature(self::ALLOW_REGISTER)) {
00054 $ret['register'] = new ExactMatchRoute('https://register', $this, 'register', new NoCacheCacheManager());
00055 }
00056 if ($this->has_feature(self::ALLOW_LOST_PASSWORD)) {
00057 $ret['lost_password'] = new ExactMatchRoute('https://lost-password', $this, 'lost_password', new NoCacheCacheManager());
00058 }
00059 if ($this->has_feature(self::ALLOW_REGISTER | self::ALLOW_RESEND_REGISTRATION)) {
00060 $ret['resend_registration_mail'] = new ExactMatchRoute('https://resend-registration-mail', $this, 'resend_registration_mail', new NoCacheCacheManager());
00061 }
00062 if ($this->has_feature(self::SUPPORT_DASHBOARD)) {
00063 $ret['dashboard'] = new ExactMatchRoute('https://user', $this, 'dashboard', new AccessRenderDecorator());
00064 }
00065 if ($this->has_feature(self::SUPPORT_CONFIRM_DATA)) {
00066 $ret['confirm'] = new ExactMatchRoute('https://user/confirm', $this, 'users_confirm', new AccessRenderDecorator());
00067 $ret['confirm_mail'] = new ExactMatchRoute('https://user/confirm/mail', $this, 'users_confirm_mail', new AccessRenderDecorator());
00068 }
00069 return $ret;
00070 }
00071
00072
00073
00074
00075
00076
00077 protected function get_features_policy() {
00078 return self::ALL_FEATURES ^ self::SUPPORT_TOS;
00079 }
00080
00081 protected function has_feature($feature) {
00082 return Common::flag_is_set($this->get_features_policy(), $feature);
00083 }
00084
00085
00086
00087
00088
00089
00090
00091 protected function create_dashboards($user) {
00092 if (empty($user) || !$this->has_feature(self::SUPPORT_DASHBOARD)) {
00093 return null;
00094 }
00095
00096 $ret = array();
00097
00098 foreach ($user->get_role_names() as $role) {
00099 $role = String::plain_ascii($role);
00100 $dashboard_file = 'controller/tools/dashboards/' . $role . '.dashboard.php';
00101 $dashboard_class = ucfirst($role) . 'Dashboard';
00102 $found = Load::first_file($dashboard_file);
00103 if ($found) {
00104 $ret[] = new $dashboard_class($user);
00105 }
00106 }
00107
00108
00109 $dashboard_file = 'controller/tools/dashboards/default.dashboard.php';
00110 Load::first_file($dashboard_file);
00111 $ret[] = new DefaultDashboard($user);
00112
00113 return $ret;
00114 }
00115
00116
00117
00118
00119 public function preprocess($page_data) {
00120 $this->dashboards = $this->create_dashboards(Users::get_current_user());
00121 parent::preprocess($page_data);
00122 }
00123
00124
00125
00126
00127 public function before_action() {
00128 Load::tools(array('formhandler', 'filtertext'));
00129 }
00130
00131
00132
00133
00134
00135
00136
00137 public function on_event($name, $params, &$result) {
00138 if ($name == 'block' && $params['name'] === 'user') {
00139 $result[] = $this->do_user_block();
00140 }
00141 }
00142
00143
00144
00145
00146
00147
00148 protected function do_user_block() {
00149 $user = Users::is_logged_in() ? Users::get_current_user() : NULL;
00150 $block = new BlockBase('user', $this->get_block_title($user), '');
00151
00152 $view = ViewFactory::create_view(IViewFactory::MESSAGE, 'users/blocks/menu');
00153 $view->assign('user', $user);
00154 $view->assign('prefix', $this->create_user_block_prefix($user));
00155 $view->assign('menu_list', $this->create_user_block_menu_list($user));
00156 $view->assign('postfix', $this->create_user_block_postfix($user));
00157 $view->assign('block', $block);
00158
00159 $block->set_content($view->render());
00160 return $block;
00161 }
00162
00163
00164
00165
00166
00167
00168
00169 protected function get_block_title($user) {
00170 return tr('User Menu', 'users');
00171 }
00172
00173
00174
00175
00176
00177
00178
00179 protected function create_user_block_prefix($user) {
00180 $ret = '';
00181 if ($user) {
00182 $block_text = tr(
00183 'Logged in as %user%',
00184 'users',
00185 array('%user%' => html::span($user->name, 'logged_in_as'))
00186 );
00187 $ret = html::p($block_text, 'logged_in_as');
00188 }
00189 return $ret;
00190 }
00191
00192
00193
00194
00195
00196
00197
00198 protected function create_user_block_menu_list($user) {
00199 $li = array();
00200 if ($user) {
00201 if ($this->dashboards) {
00202 $li[] = html::a(
00203 tr('Your personal site', 'users'),
00204 ActionMapper::get_url('dashboard', $user),
00205 ''
00206 );
00207 foreach($this->dashboards as $dashboard) {
00208 $li = array_merge($li, $dashboard->get_user_menu_entries());
00209 }
00210 }
00211 }
00212 else {
00213 if ($this->has_feature(self::ALLOW_LOGIN)) {
00214 $li[] = html::a(
00215 tr('Login', 'users'),
00216 ActionMapper::get_url('login'),
00217 tr('Log into %app%', 'users', array('%app%' => Config::get_value(Config::TITLE)))
00218 );
00219 }
00220 if ($this->has_feature(self::ALLOW_REGISTER)) {
00221 $li[] = html::a(
00222 tr('Register', 'users'),
00223 ActionMapper::get_url('register'),
00224 tr('Registered user can add and edit entries', 'users')
00225 );
00226 }
00227
00228 }
00229 return $li;
00230 }
00231
00232
00233
00234
00235
00236
00237
00238 protected function create_user_block_postfix($user) {
00239 $ret = '';
00240 if ($user) {
00241 $ret .= html::form(
00242 'frmlogout',
00243 ActionMapper::get_url('logout'),
00244 html::submit(
00245 tr('Logout', 'users'),
00246 'btnlogout',
00247 tr('Quit %app%', 'users', array('%app%' => Config::get_value(Config::TITLE)))
00248 )
00249 );
00250 }
00251 return $ret;
00252 }
00253
00254
00255
00256
00257
00258
00259
00260 public function action_login($page_data) {
00261 $err = $this->check_login_preconditions();
00262 if ($err->is_error()) {
00263 $page_data->error($err);
00264 return;
00265 }
00266
00267 $formhandler = new FormHandler('login');
00268 if ($page_data->has_post_data()) {
00269 $this->do_login($formhandler, $page_data);
00270 }
00271
00272 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'core::users/login', $page_data);
00273 $formhandler->prepare_view($view);
00274 $view->assign('goto', Session::peek('login_goto'));
00275 $view->render();
00276
00277 $page_data->in_history = false;
00278 }
00279
00280
00281
00282
00283 public function action_logout($page_data) {
00284 Users::logout();
00285 History::go_to(0, new Message(tr('You have been logged out', 'users')), Config::get_url(Config::URL_DEFAULT_PAGE));
00286 exit;
00287 }
00288
00289
00290
00291
00292 public function action_user_delete_account($page_data) {
00293 if (Users::current_has_role(USER_ROLE_USER) == false) {
00294 return self::ACCESS_DENIED;
00295 }
00296
00297 $formhandler = new FormHandler('delete_account');
00298 if ($page_data->has_post_data()) {
00299 $this->do_delete_account($formhandler, $page_data);
00300 }
00301
00302 $view = content_view_create('user_delete_account', $page_data);
00303 $formhandler->prepare_view($view);
00304 $view->render();
00305
00306 $page_data->in_history = false;
00307 }
00308
00309
00310
00311
00312 public function action_register($page_data) {
00313 $err = $this->check_login_preconditions();
00314 if ($err->is_error()) {
00315 $page_data->error($err);
00316 return;
00317 }
00318
00319 $formhandler = new FormHandler('register');
00320 if ($page_data->has_post_data()) {
00321 $this->do_register($formhandler, $page_data);
00322 }
00323
00324 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'users/register', $page_data);
00325 $view->assign('feature_resend', $this->has_feature(self::ALLOW_RESEND_REGISTRATION));
00326 $view->assign('feature_tos', $this->has_feature(self::SUPPORT_TOS));
00327
00328 $formhandler->prepare_view($view);
00329 $view->render();
00330
00331 $page_data->in_history = false;
00332 }
00333
00334
00335
00336
00337 public function action_lost_password($page_data) {
00338 $err = $this->check_login_preconditions();
00339 if ($err->is_error()) {
00340 $page_data->error($err);
00341 return;
00342 }
00343
00344 $formhandler = new FormHandler('lost_password');
00345 if ($page_data->has_post_data()) {
00346 $this->do_lost_password($formhandler, $page_data);
00347 }
00348
00349 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'users/lost_password', $page_data);
00350 $formhandler->prepare_view($view);
00351 $view->render();
00352
00353 $page_data->in_history = false;
00354 }
00355
00356
00357
00358
00359 public function action_resend_registration_mail($page_data) {
00360 $err = $this->check_login_preconditions();
00361 if ($err->is_error()) {
00362 $page_data->error($err);
00363 return;
00364 }
00365
00366 $formhandler = new FormHandler('resend_registration');
00367 if ($page_data->has_post_data()) {
00368 $this->do_resend_registration_mail($formhandler, $page_data);
00369 }
00370
00371 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'users/resend_registration_mail', $page_data);
00372 $formhandler->prepare_view($view);
00373 $view->render();
00374
00375 $page_data->in_history = false;
00376 }
00377
00378
00379
00380
00381 public function action_dashboard($page_data) {
00382 if (Users::is_logged_in() == false) {
00383 return CONTROLLER_ACCESS_DENIED;
00384 }
00385
00386 $dashboards = $this->create_dashboards(Users::get_current_user());
00387 if ($dashboards) {
00388 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'users/dashboard', $page_data);
00389 $view->assign('dashboards', $dashboards);
00390 $view->render();
00391 }
00392 else {
00393 return CONTROLLER_INTERNAL_ERROR;
00394 }
00395 }
00396
00397
00398
00399
00400 public function action_users_create($page_data) {
00401 $formhandler = new FormHandler('user_create');
00402 if ($page_data->has_post_data()) {
00403 $this->do_create($formhandler, $page_data);
00404 }
00405
00406 $page_data->in_history = false;
00407
00408 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'users/create', $page_data);
00409 $roleOptions = Users::get_user_roles();
00410 $view->assign('role_options', $roleOptions);
00411 $view->assign('user', $user);
00412 $formhandler->prepare_view($view, $user);
00413
00414 $view->render();
00415 }
00416
00417
00418
00419
00420
00421
00422
00423 protected function do_create($formhandler, $page_data) {
00424 $err = $formhandler->validate();
00425 if ($err->is_ok()) {
00426
00427 $params = $page_data->get_post()->get_array();
00428 $err->merge($this->validate_password($params));
00429 if ($err->is_ok()) {
00430 $dummy = false;
00431 $err->merge(Users::create($params, $dummy));
00432 }
00433 }
00434 $formhandler->finish($err, tr('The new user has been created', 'users'));
00435 }
00436
00437
00438
00439
00440 public function action_users_edit($page_data, $id) {
00441 $user = Users::get($id);
00442 if ($user == false) {
00443 return self::NOT_FOUND;
00444 }
00445 foreach($user->get_roles() as $role) {
00446 $user->roles[] = $role->id;
00447 }
00448
00449 $formhandler = new FormHandler('edit_account');
00450 if ($page_data->has_post_data()) {
00451 $this->do_edit($formhandler, $user, $page_data);
00452 }
00453
00454 $page_data->in_history = false;
00455 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'users/edit', $page_data);
00456
00457
00458 $roleOptions = Users::get_user_roles();
00459 $view->assign('role_options', $roleOptions);
00460 $view->assign('user', $user);
00461
00462 $formhandler->prepare_view($view, $user);
00463
00464 $view->render();
00465 }
00466
00467
00468
00469
00470
00471
00472
00473 protected function validate_password(&$arr_post) {
00474 $ret = new Status();
00475
00476 $pwd1 = Arr::get_item($arr_post, 'pwd1', '');
00477 $pwd2 = Arr::get_item($arr_post, 'pwd2', '');
00478 if ($pwd1 != $pwd2) {
00479 $ret->append(tr('Password and password confirmation are different', 'users'));
00480 }
00481
00482 if ($ret->is_ok()) {
00483 if ($pwd1 !== '') {
00484 $arr_post['password'] = $pwd1;
00485 }
00486 }
00487 return $ret;
00488 }
00489
00490
00491
00492
00493
00494
00495
00496
00497 protected function do_edit($formhandler, $user, $page_data) {
00498 $err = $formhandler->validate();
00499 if ($err->is_ok()) {
00500
00501 $params = $page_data->get_post()->get_array();
00502 $err->merge($this->validate_password($params));
00503 if ($err->is_ok()) {
00504 $err->merge(Users::update($user, $params));
00505 }
00506 }
00507 $formhandler->finish($err, tr('Your changes have been saved', 'users'));
00508 }
00509
00510
00511
00512
00513 public function action_users_edit_self($page_data) {
00514
00515 Users::reload_current();
00516 $user = Users::get_current_user();
00517 $formhandler = new FormHandler('edit_account_self');
00518 if ($page_data->has_post_data()) {
00519 $this->do_edit_self($formhandler, $user, $page_data);
00520 }
00521
00522 $page_data->in_history = false;
00523
00524 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'users/edit_self', $page_data);
00525 $formhandler->prepare_view($view, $user);
00526 $view->assign('user', $user);
00527 $view->render();
00528 }
00529
00530
00531
00532
00533
00534
00535
00536
00537 protected function do_edit_self($formhandler, $user, $page_data) {
00538 $err = $formhandler->validate();
00539 if ($err->is_ok()) {
00540
00541 $params = $user->unset_internals($page_data->get_post()->get_array());
00542 $err->merge($this->validate_email_change($params, $user, $page_data->get_post()->get_item('pwd_mail')));
00543 $err->merge($this->validate_password($params));
00544 if ($err->is_ok()) {
00545 $err->merge(Users::update($user, $params));
00546 }
00547 }
00548 $formhandler->finish($err, tr('Your changes have been saved', 'users'));
00549 }
00550
00551
00552
00553
00554
00555
00556
00557
00558 protected function validate_email_change($params, $user, $pwd) {
00559 $err = new Status();
00560 if (Config::has_feature(ConfigUsermanagement::ENABLE_PWD_ON_EMAILCHANGE) && $params['email'] != $user->email) {
00561 if (!Users::get_current_user()->password_match($pwd)) {
00562 $err->append(tr('The password entered for email change confirmation is not correct. Please try again.', 'users'));
00563 }
00564 }
00565 return $err;
00566 }
00567
00568
00569
00570
00571 public function action_users_confirm($page_data) {
00572 $page_data->in_history = false;
00573
00574
00575 Users::reload_current();
00576 $user = Users::get_current_user();
00577 $formhandler = new FormHandler('users_confirm');
00578 if ($page_data->has_post_data()) {
00579 $this->do_confirm($formhandler, $user, $page_data);
00580 }
00581
00582 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'users/confirm', $page_data);
00583 $this->prepare_confirm_view($view, $formhandler, $user);
00584 $view->render();
00585 }
00586
00587
00588
00589
00590
00591
00592
00593
00594 protected function prepare_confirm_view($view, $formhandler, $user) {
00595 $formhandler->prepare_view($view, $user);
00596 $view->assign('user', $user);
00597 $view->assign('do_tos', $this->has_feature(self::SUPPORT_TOS) && !$user->confirmed_tos());
00598 $view->assign('do_email', !$user->confirmed_email());
00599 }
00600
00601
00602
00603
00604
00605
00606
00607
00608 protected function do_confirm($formhandler, $user, $page_data) {
00609 $validate_email_cmd = false;
00610 $err = $formhandler->validate();
00611 if ($err->is_ok()) {
00612 $post = $page_data->get_post();
00613 $err->merge($this->process_confirm_data($post->get_array(), $post->get_item('tos'), $user, $validate_email_cmd));
00614
00615
00616 if ($err->is_ok()) {
00617 $err->merge(Users::update($user, $params));
00618 }
00619
00620 if ($validate_email_cmd && $err->is_ok()) {
00621 $err->merge($validate_email_cmd->execute());
00622 }
00623 }
00624 $formhandler->finish($err, tr('Your changes have been saved', 'users'));
00625 }
00626
00627 protected function process_confirm_data(&$params, $tos, $user, &$validate_email_cmd) {
00628 $err = new Status();
00629
00630
00631 if($this->has_feature(self::SUPPORT_TOS) && !$user->confirmed_tos() && !$tos) {
00632 $err->append(tr('Please agree to the Terms of Service.', 'users'));
00633 }
00634
00635 $params = $user->unset_internals($params);
00636 $params['tos_version'] = Config::get_value(ConfigUsermanagement::TOS_VERSION);
00637 $err->merge($this->validate_password($params));
00638
00639
00640 $email = Arr::get_item($params, 'email', '');
00641 if (!$user->confirmed_email() && ($user->email == $email) && Validation::is_email($email)) {
00642
00643 $params = array(
00644 'id_item' => $user->id,
00645 'action' => 'validateemail',
00646 'data' => $email
00647 );
00648 Session::push('user_confirm_mail_send', true);
00649 $validate_email_cmd = CommandsFactory::create_command('confirmations', 'create', $params);
00650 }
00651
00652 return $err;
00653 }
00654
00655
00656
00657
00658 public function action_users_confirm_mail($page_data) {
00659
00660 $page_data->in_history = false;
00661 Users::reload_current();
00662 $user = Users::get_current_user();
00663 if ($user->confirmed_email()) {
00664 History::go_to(0);
00665 }
00666 else {
00667 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'users/confirm_mail', $page_data);
00668 $view->assign('user' , $user);
00669 $view->render();
00670 }
00671 }
00672
00673
00674
00675
00676 public function action_users_list_all($page_data) {
00677 $view = ViewFactory::create_view(IViewFactory::CONTENT, 'users/list', $page_data);
00678 $users = Users::create_all_user_adapter();
00679
00680 Load::tools(array('sorter', 'filter', 'filterusername', 'pager'));
00681 $sorter = new Sorter($page_data, $users->get_sortable_columns(), $users->get_sort_default_column());
00682 $sorter->apply($users);
00683 $sorter->prepare_view($view);
00684
00685 $filter = new Filter($page_data, $users->get_filters());
00686 $filter->apply($users);
00687 $filter->prepare_view($view);
00688
00689 $filtertext = new FilterUsername($page_data);
00690 $filtertext->apply($users);
00691 $filtertext->prepare_view($view);
00692
00693 $count_users = $users->count();
00694 $pager = new Pager($page_data, $count_users, Config::get_value(Config::ITEMS_PER_PAGE));
00695 $pager->apply($users);
00696 $pager->prepare_view($view);
00697
00698 $view->assign('users', $users->execute());
00699 $view->render();
00700 }
00701
00702
00703
00704
00705
00706
00707 public function action_users_list_confirmations($page_data) {
00708 Load::tools(array('sorter', 'filter', 'filtertext', 'pager'));
00709 $url = Url::current()->set_path(ActionMapper::get_path('users_list_all'));
00710 Filter::apply_to_url($url, 'unconfirmed', 'status');
00711 $url->redirect();
00712 }
00713
00714
00715
00716
00717 protected function check_login_preconditions() {
00718 $ret = new Status();
00719
00720
00721
00722 if (Users::is_logged_in()) {
00723 $ret->append(tr('Already logged in', 'users'));
00724 }
00725 return $ret;
00726 }
00727
00728
00729
00730
00731
00732
00733 protected function do_login($formhandler, $page_data) {
00734 $err = $formhandler->validate();
00735 if ($err->is_ok()) {
00736 $post = $page_data->get_post();
00737 $permanent = $post->get_item('stayloggedin', false) != false;
00738
00739 $err->merge(Users::login($post->get_array(), $permanent));
00740 if ($err->is_ok()) {
00741 $goto = $post->get_item('goto', '');
00742 if ($goto) {
00743
00744 $goto_url = Url::create($goto)->set_host(Config::get_value(Config::URL_DOMAIN));
00745 History::push($goto_url->build(Url::ABSOLUTE));
00746 }
00747 else if ($this->has_feature(self::SUPPORT_DASHBOARD)) {
00748 History::push(Config::get_url(ConfigUsermanagement::DEFAULT_PAGE));
00749 }
00750 Session::pull('login_goto');
00751 }
00752 }
00753 $formhandler->finish($err, tr('Welcome! You are now logged in.', 'users'));
00754 exit;
00755 }
00756
00757
00758
00759
00760 protected function do_delete_account($formhandler, $page_data) {
00761 $err = $formhandler->validate();
00762 if ($err->is_ok()) {
00763
00764 $cmd = CommandsFactory::create_command(Users::get_current_user(), 'status', USER_STATUS_DELETED);
00765 $err->merge($cmd->execute());
00766
00767 if ($err->is_ok()) {
00768
00769 Users::logout();
00770 $msg = new Message(tr('Your account has been deleted', 'users'));
00771 $msg->persist();
00772 Url::create(Config::get_url(Config::URL_BASEURL))->redirect();
00773 exit;
00774 }
00775 }
00776
00777 $formhandler->fix_post_history($err);
00778 exit;
00779 }
00780
00781
00782
00783
00784
00785
00786 protected function do_register($formhandler, $page_data) {
00787 $err = $formhandler->validate();
00788 if ($err->is_ok()) {
00789
00790 $post = $page_data->get_post();;
00791 $pwd1 = $post->get_item('pwd1');
00792 $pwd2 = $post->get_item('pwd2');
00793 if ($pwd1 != $pwd2) {
00794 $err->append(tr('Password and password confirmation are different', 'users'));
00795 }
00796
00797 if ($this->has_feature(self::SUPPORT_TOS) && !$post->get_item('tos')) {
00798 $err->append(tr('Please agree to the Terms of Service.', 'users'));
00799 }
00800
00801 if ($err->is_ok()) {
00802 $result = false;
00803 $err->merge(Users::register(trim($post->get_item('name')), $pwd1, trim($post->get_item('email')), $result));
00804 }
00805 }
00806 $formhandler->finish($err, tr('Your registration request has been created', 'users'));
00807 exit;
00808 }
00809
00810
00811
00812
00813 protected function do_lost_password($formhandler, $page_data) {
00814 $err = $formhandler->validate();
00815 if ($err->is_ok()) {
00816
00817 $post = $page_data->get_post();;
00818 $email = $post->get_item('email');
00819 $err->merge(Users::lost_password($email));
00820 }
00821 $formhandler->finish($err, tr('Your one time login request has been created', 'users'));
00822 exit;
00823 }
00824
00825
00826
00827
00828 protected function do_resend_registration_mail(FormHandler $formhandler, PageData $page_data) {
00829 $err = $formhandler->validate();
00830 if ($err->is_ok()) {
00831
00832 $post = $page_data->get_post();;
00833 $email = $post->get_item('email');
00834 $err->merge(Users::resend_registration_mail($email));
00835 }
00836
00837 $formhandler->finish($err, tr('Your activation information mail has been send to you again', 'users'));
00838 exit;
00839 }
00840
00841 }