gui fixes

This commit is contained in:
SJ
2013-08-14 23:40:52 +02:00
parent b3cea9de7f
commit 29482ffb1d
47 changed files with 1065 additions and 497 deletions

View File

@ -50,7 +50,8 @@ class ControllerUserAdd extends Controller {
}
}
else {
$this->data['errorstring'] = array_pop($this->error);
$this->data['errorstring'] = $this->data['text_error_message'];
$this->data['errors'] = $this->error;
}
if($ret == 0) {
@ -62,6 +63,7 @@ class ControllerUserAdd extends Controller {
}
else {
$this->data['next_user_id'] = $this->model_user_user->get_next_uid();
// not sure these are needed
$this->data['groups'] = $this->model_group_group->get_groups();
$this->data['folders'] = $this->model_folder_folder->get_folders();
}
@ -71,31 +73,32 @@ class ControllerUserAdd extends Controller {
$this->data['errorstring'] = $this->data['text_you_are_not_admin'];
}
$this->render();
}
private function validate() {
if(!isset($this->request->post['password']) || !isset($this->request->post['password2']) ) {
private function validate() {
//password is required and must be greater than the MIN_PASSWORD_LENGTH
if(!isset($this->request->post['password'])) {
$this->error['password'] = $this->data['text_missing_password'];
}
if(strlen(@$this->request->post['password']) < MIN_PASSWORD_LENGTH || strlen(@$this->request->post['password2']) < MIN_PASSWORD_LENGTH) {
} elseif (strlen(@$this->request->post['password']) < MIN_PASSWORD_LENGTH) {
$this->error['password'] = $this->data['text_too_short_password'];
}
if($this->request->post['password'] != $this->request->post['password2']) {
$this->error['password'] = $this->data['text_password_mismatch'];
//password2 is required and must be greater than the MIN_PASSWORD_LENGTH
if(!isset($this->request->post['password2'])) {
$this->error['password2'] = $this->data['text_missing_password'];
} elseif (strlen(@$this->request->post['password2']) < MIN_PASSWORD_LENGTH) {
$this->error['password2'] = $this->data['text_too_short_password'];
}
//passwords must match (put here to override the password2 missing message, if also present)
if($this->request->post['password'] != $this->request->post['password2']) {
$this->error['password2'] = $this->data['text_password_mismatch'];
}
//uid is required and must be numeric & 0 or greater
if(!isset($this->request->post['uid']) || !is_numeric($this->request->post['uid']) || $this->request->post['uid'] < 0) {
$this->error['uid'] = $this->data['text_invalid_uid'];
}
//email address is required and must be in the proper format
if(!isset($this->request->post['email']) || strlen($this->request->post['email']) < 3) {
$this->error['email'] = $this->data['text_invalid_email'];
}
@ -114,15 +117,15 @@ class ControllerUserAdd extends Controller {
}
}
}
//username is required and must be greater than 2 chars
if(!isset($this->request->post['username']) || strlen($this->request->post['username']) < 2) {
$this->error['username'] = $this->data['text_invalid_username'];
}
//username is required and must be unique
if(isset($this->request->post['username']) && $this->model_user_user->get_uid_by_name($this->request->post['username']) > 0) {
$this->error['username'] = $this->data['text_existing_user'];
}
//primary domain is required
if(!isset($this->request->post['domain'])) {
$this->error['domain'] = $this->data['text_missing_data'];
}

View File

@ -66,11 +66,11 @@ class ControllerUserEdit extends Controller {
$__username = $this->request->post['username'];
}
else {
$this->template = "common/error.tpl";
$this->data['errorstring'] = array_pop($this->error);
$this->data['errorstring'] = $this->data['text_error_message'];
$this->data['errors'] = $this->error;
}
}
else {
//else {
$this->data['user'] = $this->model_user_user->get_user_by_uid($this->data['uid']);
$this->data['user']['domains'] = $this->model_user_user->get_domains_by_uid($this->data['uid']);
@ -80,22 +80,28 @@ class ControllerUserEdit extends Controller {
$this->data['emails'] = $this->model_user_user->get_emails($this->data['user']['username']);
}
//}
}
else {
$this->template = "common/error.tpl";
$this->data['errorstring'] = $this->data['text_you_are_not_admin'];
}
$this->render();
}
private function validate() {
//if provided, the password must be greater than the MIN_PASSWORD_LENGTH
if(isset($this->request->post['password']) && strlen(@$this->request->post['password']) < MIN_PASSWORD_LENGTH) {
$this->error['password'] = $this->data['text_too_short_password'];
}
//if provided, the password2 must be greater than the MIN_PASSWORD_LENGTH
if(isset($this->request->post['password2']) && strlen(@$this->request->post['password2']) < MIN_PASSWORD_LENGTH) {
$this->error['password2'] = $this->data['text_too_short_password'];
}
if(isset($this->request->post['password']) && strlen(@$this->request->post['password']) > 1) {
if(strlen(@$this->request->post['password']) < MIN_PASSWORD_LENGTH || strlen(@$this->request->post['password2']) < MIN_PASSWORD_LENGTH) {

View File

@ -91,6 +91,9 @@ class ControllerUserList extends Controller {
$this->data['total_pages'] = floor($this->data['total_users'] / $this->data['page_len']);
$this->data['querystring'] = '';
if ($this->data['page'] != 1) { $this->data['querystring'] .= "&amp;page=".$this->data['page']; }
if (strlen($this->data['search']) > 0) { $this->data['querystring'] .= "&amp;search=".$this->data['search']; }
$this->render();
}

View File

@ -23,7 +23,7 @@ class ControllerUserRemove extends Controller {
$this->data['username'] = Registry::get('username');
$this->data['uid'] = (int)@$this->request->get['uid'];
$this->data['uid'] = (int)@$this->request->get['id'];
$this->data['user'] = @$this->request->get['user'];
$this->data['confirmed'] = (int)@$this->request->get['confirmed'];
@ -57,7 +57,7 @@ class ControllerUserRemove extends Controller {
$this->error['admin'] = $this->data['text_you_are_not_admin'];
}
if(!isset($this->request->get['uid']) || !is_numeric($this->request->get['uid']) || $this->request->get['uid'] < 1 ) {
if(!isset($this->request->get['id']) || !is_numeric($this->request->get['id']) || $this->request->get['id'] < 1 ) {
$this->error['username'] = $this->data['text_invalid_uid'];
}
@ -70,7 +70,6 @@ class ControllerUserRemove extends Controller {
}
}
?>