Showing 2 changed files with 17 additions and 17 deletions
+16 -16
templates/auto/_admin/users.html.ep
... ...
@@ -4,22 +4,22 @@
4 4
   
5 5
   my $errors;
6 6
   if ($op eq 'delete' && lc $self->req->method eq 'post') {
7
-
8
-    # Validation
9
-    my $params = $api->params;
10
-    my $vc = $self->app->vc;
11
-    my $rule = [
12
-      user => [
13
-        ['not_blank' => 'User name is empty.'],
14
-      ]
15
-    ];
16
-    my $vresult = $vc->validate($params, $rule);
17 7
     
18
-    if ($vresult->is_ok) {
19
-      
20
-      # Valid parameters
21
-      my $params = $vresult->data;
22
-      my $user = $params->{user};
8
+    # Parameters
9
+    my $user = param('user');
10
+    
11
+    # Validator
12
+    my $vc = app->vc;
13
+    
14
+    # Validation result
15
+    my $validation = $vc->validation;
16
+    
17
+    # "user" check
18
+    if (!(defined $user && length $user)) {
19
+      $validation->add_failed(user => 'User name is empty.');
20
+    }
21
+
22
+    if ($validation->is_valid) {
23 23
       
24 24
       # Delete user
25 25
       my $count;
... ...
@@ -38,7 +38,7 @@
38 38
         return;
39 39
       }
40 40
     }
41
-    else { $errors = $vresult->messages }
41
+    else { $errors = $validation->messages }
42 42
   }
43 43
   
44 44
   my $users = app->manager->users;
+1 -1
templates/settings.html.ep
... ...
@@ -29,7 +29,7 @@
29 29
     my $validation = $vc->validation;
30 30
     
31 31
     # "to-project" check
32
-    if (!length $to_project) {
32
+    if (!(defined $project && length $to_project)) {
33 33
       $validation->add_failed('to-project' => 'Repository name is empty.');
34 34
     }
35 35
     elsif (!$vc->check($to_project, 'project_name')) {