/** * @Route("/new/{userid}", methods={"GET"}, name="userroleenew") */ public function newAction($userid) { $user = User::findFirstByid($userid); $this->view->username = $user->username; $this->get_assets(); $this->set_form_routes($this->crud_params['create_route'] . '/' . $userid, $this->crud_params['route_list'] . '/' . $userid, $this->crud_params['new_title'], $this->crud_params['add_edit_view'], 'new', null, $this->crud_params['form_name'], $this->crud_params['form_columns'], $this->crud_params['save_button_name'], $this->crud_params['cancel_button_name'], ''); }
/** * @Route("/change_password/{id}", methods={"POST"}, name="change_password") */ public function Change_password_Action($id) { $entity = User::findFirstByid($id); if (!$entity) { $this->flash->error($this->crud_params['not_found_message']); return $this->dispatcher->forward(array("controller" => "user", "action" => "set_password_change")); } $message = $this->validate_password($this->request->getPost("password"), $this->request->getPost("confirm_password")); if ($message == "") { $entity->setPassword($this->getDI()->getSecurity()->hash($this->request->getPost("password"))); if (!$entity->save()) { foreach ($entity->getMessages() as $message) { $this->flash->error($message); } return $this->dispatcher->forward(array("controller" => "user", "action" => "set_password_change", "params" => array($id))); } else { $this->response->redirect(array('for' => 'userlist')); } } else { $this->flash->error($message); $this->dispatcher->forward(array("action" => "set_password_change", "parameters" => array($id))); } }