Showing 5 changed files with 37 additions and 37 deletions
+10 -10
templates/auto/_admin/user/create.html.ep
... ...
@@ -9,7 +9,7 @@
9 9
     # Parameters
10 10
     my $id = param('id');
11 11
     my $name = param('name');
12
-    my $mail = param('mail');
12
+    my $email = param('email');
13 13
     my $password = param('password');
14 14
     my $password2 = param('password2');
15 15
     
... ...
@@ -39,17 +39,17 @@
39 39
     # "name" check
40 40
     $name //= '';
41 41
     
42
-    # "mail" check
43
-    if (!(defined $mail && length $mail)) {
44
-      $validation->add_failed(mail => "Mail must be not empty");
42
+    # "email" check
43
+    if (!(defined $email && length $email)) {
44
+      $validation->add_failed(email => "Mail must be not empty");
45 45
     }
46
-    elsif ($mail !~ /\@/) {
47
-      $validation->add_failed(mail => "Invalid mail address");
46
+    elsif ($email !~ /\@/) {
47
+      $validation->add_failed(email => "Invalid mail address");
48 48
     }
49 49
     else {
50
-      my $row = app->dbi->model('user')->select(where => {mail => $mail})->one;
50
+      my $row = app->dbi->model('user')->select(where => {email => $email})->one;
51 51
       if ($row) {
52
-        $validation->add_failed(mail => "Mail $mail already exists");
52
+        $validation->add_failed(email => "Mail $email already exists");
53 53
       }
54 54
     }
55 55
     
... ...
@@ -73,7 +73,7 @@
73 73
       $params->{password} = $password_encrypted;
74 74
       $params->{salt} = $salt;
75 75
       $params->{name} = $name;
76
-      $params->{mail} = $mail;
76
+      $params->{email} = $email;
77 77
       
78 78
       # Create user
79 79
       eval { app->manager->create_user($id, $params) };
... ...
@@ -131,7 +131,7 @@
131 131
         <div>
132 132
           <div>Mail</div>
133 133
           <div>
134
-            <%= text_field 'mail', placeholder => 'Mail' %>
134
+            <%= text_field 'email', placeholder => 'Mail' %>
135 135
           </div>
136 136
         </div>
137 137
         <div>
+11 -11
templates/auto/_admin/user/update.html.ep
... ...
@@ -10,7 +10,7 @@
10 10
     # Parameters
11 11
     my $id = param('id');
12 12
     my $name = param('name');
13
-    my $mail = param('mail');
13
+    my $email = param('email');
14 14
     
15 15
     # Validator
16 16
     my $vc = app->vc;
... ...
@@ -26,22 +26,22 @@
26 26
     # "name" check
27 27
     $name //= '';
28 28
     
29
-    # "mail" check
30
-    if (!(defined $mail && length $mail)) {
31
-      $validation->add_failed(mail => "Mail must be not empty");
29
+    # "email" check
30
+    if (!(defined $email && length $email)) {
31
+      $validation->add_failed(email => "Mail must be not empty");
32 32
     }
33
-    elsif ($mail !~ /\@/) {
34
-      $validation->add_failed(mail => "Invalid mail address");
33
+    elsif ($email !~ /\@/) {
34
+      $validation->add_failed(email => "Invalid mail address");
35 35
     }
36 36
     else {
37 37
       my $where = app->dbi->where;
38 38
       my $clause = [
39 39
         'and',
40
-        ':mail{=}',
40
+        ':email{=}',
41 41
         ':id{<>}'
42 42
       ];
43 43
       my $param = {
44
-        mail => $mail,
44
+        email => $email,
45 45
         id => $user_id
46 46
       };
47 47
       $where->clause($clause);
... ...
@@ -49,7 +49,7 @@
49 49
       
50 50
       my $row = app->dbi->model('user')->select(where => $where)->one;
51 51
       if ($row) {
52
-        $validation->add_failed(mail => "Mail $mail already exists");
52
+        $validation->add_failed(email => "Mail $email already exists");
53 53
       }
54 54
     }
55 55
     
... ...
@@ -58,7 +58,7 @@
58 58
       # Encrypt password
59 59
       my $params = {};
60 60
       $params->{name} = $name;
61
-      $params->{mail} = $mail;
61
+      $params->{email} = $email;
62 62
       
63 63
       # Update user
64 64
       eval { app->dbi->model('user')->update($params, where => {id => $id}) };
... ...
@@ -121,7 +121,7 @@
121 121
         <div>
122 122
           <div><b>Mail</b></div>
123 123
           <div>
124
-            <%= text_field 'mail' => $user->{mail}, placeholder => 'Mail' %>
124
+            <%= text_field 'email' => $user->{email}, placeholder => 'Mail' %>
125 125
           </div>
126 126
         </div>
127 127
         <div>
+1 -1
xt/import_rep.t
... ...
@@ -44,7 +44,7 @@ note 'import_rep';
44 44
   $t->content_like(qr/Admin/);
45 45
 
46 46
   # Create user
47
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', mail => 'kimoto@foo.com', password => 'a', password2 => 'a'});
47
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', email => 'kimoto@foo.com', password => 'a', password2 => 'a'});
48 48
   $t->content_like(qr/Success.*created/);
49 49
   
50 50
   # Import repositories
+3 -3
xt/smart_http.t
... ...
@@ -45,7 +45,7 @@ note 'Smart HTTP';
45 45
   $t->content_like(qr/Admin/);
46 46
   
47 47
   # Create user
48
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', mail => 'kimoto@foo.com', password => 'a', password2 => 'a'});
48
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', email => 'kimoto@foo.com', password => 'a', password2 => 'a'});
49 49
   $t->content_like(qr/Success.*created/);
50 50
 
51 51
   # Login as kimoto
... ...
@@ -155,9 +155,9 @@ note 'Private repository and collaborator';
155 155
   $t->content_like(qr/Admin/);
156 156
   
157 157
   # Create user
158
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', mail => 'kimoto@foo.com', password => 'a', password2 => 'a'});
158
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', email => 'kimoto@foo.com', password => 'a', password2 => 'a'});
159 159
   $t->content_like(qr/Success.*created/);
160
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', mail => 'kimoto2@foo.com', password => 'a', password2 => 'a'});
160
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', email => 'kimoto2@foo.com', password => 'a', password2 => 'a'});
161 161
   $t->content_like(qr/Success.*created/);
162 162
 
163 163
   # Login as kimoto
+12 -12
xt/user.t
... ...
@@ -132,7 +132,7 @@ note 'Admin page';
132 132
     $t->content_like(qr/Two password/);
133 133
     
134 134
     # Create user
135
-    $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', name => 'Kimoto', mail => 'kimoto@gitprep.example', password => 'a', password2 => 'a'});
135
+    $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', name => 'Kimoto', email => 'kimoto@gitprep.example', password => 'a', password2 => 'a'});
136 136
     $t->content_like(qr/Success.*created/);
137 137
   }
138 138
     
... ...
@@ -170,11 +170,11 @@ note 'Admin page';
170 170
   note 'Admin page - Update user';
171 171
   {
172 172
     # Create user
173
-    $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto-update', name => 'Kimoto-Update', mail => 'kimoto-update@gitprep.example', password => 'a', password2 => 'a'});
173
+    $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto-update', name => 'Kimoto-Update', email => 'kimoto-update@gitprep.example', password => 'a', password2 => 'a'});
174 174
     $t->content_like(qr/kimoto-update/);
175 175
     
176 176
     # Update user
177
-    $t->post_ok('/_admin/user/update?op=update', form => {id => 'kimoto-update', name => 'Kimoto-Update2', mail => 'kimoto-update2@gitprep.example'});
177
+    $t->post_ok('/_admin/user/update?op=update', form => {id => 'kimoto-update', name => 'Kimoto-Update2', email => 'kimoto-update2@gitprep.example'});
178 178
     $t->content_like(qr/Kimoto-Update2/);
179 179
     $t->content_like(qr/kimoto-update2\@gitprep\.example/);
180 180
   }
... ...
@@ -182,7 +182,7 @@ note 'Admin page';
182 182
   note 'Admin page - Delete user';
183 183
   {
184 184
     # Create user
185
-    $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto-tmp', mail => 'kimoto-tmp@gitprep.example', password => 'a', password2 => 'a'});
185
+    $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto-tmp', email => 'kimoto-tmp@gitprep.example', password => 'a', password2 => 'a'});
186 186
     $t->content_like(qr/kimoto-tmp/);
187 187
     $t->get_ok('/_admin/users');
188 188
     $t->content_like(qr/kimoto-tmp/);
... ...
@@ -235,9 +235,9 @@ note 'Reset password';
235 235
   $t->content_like(qr/Admin/);
236 236
   
237 237
   # Create user
238
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto1', mail => 'kimoto1@gitprep.example', password => 'a', password2 => 'a'});
238
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto1', email => 'kimoto1@gitprep.example', password => 'a', password2 => 'a'});
239 239
   $t->content_like(qr/kimoto1/);
240
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', mail => 'kimoto2@gitprep.example', password => 'a', password2 => 'a'});
240
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', email => 'kimoto2@gitprep.example', password => 'a', password2 => 'a'});
241 241
   $t->content_like(qr/kimoto2/);
242 242
   
243 243
   # Logout
... ...
@@ -283,9 +283,9 @@ note 'Profile';
283 283
   $t->post_ok('/_login?op=login', form => {id => 'admin', password => 'a'});
284 284
 
285 285
   # Create user
286
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto1', mail => 'kimoto1@gitprep.example', password => 'a', password2 => 'a'});
286
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto1', email => 'kimoto1@gitprep.example', password => 'a', password2 => 'a'});
287 287
   $t->content_like(qr/kimoto1/);
288
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', mail => 'kimoto2@gitprep.example', password => 'a', password2 => 'a'});
288
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', email => 'kimoto2@gitprep.example', password => 'a', password2 => 'a'});
289 289
   $t->content_like(qr/kimoto2/);
290 290
   
291 291
   # Login as kimoto1
... ...
@@ -394,7 +394,7 @@ note 'Profile';
394 394
       $t->content_like(qr/Settings is saved/);
395 395
       my $changed = $t->app->dbi->model('project')->select(
396 396
         'default_branch',
397
-        where => {user_id => 'kimoto1', name => 't2'}
397
+        where => {user => $app->gitprep_api->get_user_row_id('kimoto1'), id => 't2'}
398 398
       )->value;
399 399
       is($changed, 'b1');
400 400
     }
... ...
@@ -578,9 +578,9 @@ note 'Private repository and collaborator';
578 578
   $t->content_like(qr/Admin/);
579 579
   
580 580
   # Create user
581
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', mail => 'kimoto@gitprep.example', password => 'a', password2 => 'a'});
581
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', email => 'kimoto@gitprep.example', password => 'a', password2 => 'a'});
582 582
   $t->content_like(qr/Success.*created/);
583
-  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', mail => 'kimoto2@gitprep.example', password => 'a', password2 => 'a'});
583
+  $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', email => 'kimoto2@gitprep.example', password => 'a', password2 => 'a'});
584 584
   $t->content_like(qr/Success.*created/);
585 585
 
586 586
   # Login as kimoto
... ...
@@ -596,7 +596,7 @@ note 'Private repository and collaborator';
596 596
   $t->content_like(qr/Settings is saved/);
597 597
   my $is_private = $t->app->dbi->model('project')->select(
598 598
     'private',
599
-    where => {user_id => 'kimoto', name => 't1'}
599
+    where => {user => $app->gitprep_api->get_user_row_id('kimoto'), id => 't1'}
600 600
   )->value;
601 601
   is($is_private, 1);
602 602