Showing 3 changed files with 32 additions and 1 deletions
+10
templates/import-branch.html.ep
... ...
@@ -1,6 +1,16 @@
1 1
 <%
2
+  
3
+  my $api = gitprep_api;
4
+  
2 5
   my $user = param('user');
3 6
   my $project = param('project');
7
+  
8
+  # Authentication
9
+  unless ($api->logined($user)) {
10
+    $self->redirect_to('/');
11
+    return;
12
+  }
13
+
4 14
   my $remote_branch_abs = param('remote_branch_abs');
5 15
   my ($remote_user, $remote_project, $remote_branch) = split /\//, $remote_branch_abs, 3;
6 16
   
+3 -1
templates/network.html.ep
... ...
@@ -81,7 +81,9 @@
81 81
             </div>
82 82
             <div class="text-right">
83 83
               <button name="compare-btn" class="btn" style="margin-top:5px">Compare</button>
84
-              <button name="import-btn" class="btn" style="margin-top:5px">Import</button>
84
+            % if ($api->logined($user)) {
85
+                <button name="import-btn" class="btn" style="margin-top:5px">Import</button>
86
+            % }
85 87
             </div>
86 88
           </div>
87 89
           <hr style="margin:0">
+19
xt/user.t
... ...
@@ -460,3 +460,22 @@ note 'Delete branch';
460 460
   $t->get_ok('/kimoto1/t2/branches');
461 461
   $t->content_unlike(qr/tmp_branch/);
462 462
 }
463
+
464
+=pod
465
+note 'import-branch';
466
+{
467
+  my $app = Gitprep->new;
468
+  my $t = Test::Mojo->new($app);
469
+  $t->ua->max_redirects(3);
470
+
471
+  # Login as kimoto
472
+  $t->post_ok('/_login?op=login', form => {id => 'kimoto', password => 'a'});
473
+
474
+  # Create project
475
+  $t->post_ok('/_new?op=create', form => {project => 'import-branch1', readme => 1});
476
+  $t->content_like(qr/import-branch1\.git/);
477
+  
478
+  
479
+  $t->get_ok('/kimoto/gitprep_t/import-branch/kimoto1/gitprep_t/master');
480
+}
481
+=cut