Don't redirect to /login if authentication is required

[?]
Jul 9, 2013, 10:02 AM
2CZSW5S53UW7ACDNT5T3UQNJKFBCXCBYLQ5CL6GVCCOMKBGXZIEQC

Dependencies

  • [2] 36ZTCZ4F Add basic Persona support
  • [3] 5NO7NCKT * Refactoring.
  • [4] FPK5LF53 * Put the project-related actions in a separate controller. Put the
  • [5] J5UVLXOK * Start of a basic Catalyst web interface.
  • [6] 3PNG7NIB Remove trailing whitespace
  • [7] N45RZUQ6 Reduce I/O in build listings by only fetching required columns
  • [8] LZVO64YG Merge in the first bits of the API work
  • [9] NABL63FI * hydra: project members can do stuff that the owner can do
  • [10] LSZLZHJY Allow users to edit their own settings
  • [11] XJRJ4J7M Add user registration
  • [12] LBNVQXUB * Build the /build stuff in a separate controller.
  • [13] QTFVCDIF added hide feature for project/jobset
  • [14] CS7T2XFI
  • [15] A52HEFHQ * Allow builds to be restarted (if they failed with a transient error,
  • [16] OEPUOUNB Using twitter bootstrap for more consistent looks for Hydra
  • [17] LC64D4PU Correctly redirect to the referring page when logging in

Change contents

  • replacement in src/lib/Hydra/Controller/User.pm at line 78
    [2.140][2.140:182]()
    die if $c->request->method ne "POST";
    [2.140]
    [2.182]
    requirePost($c);
  • replacement in src/lib/Hydra/Controller/User.pm at line 88
    [2.451][2.451:552]()
    Catalyst::Exception->throw("Did not get a response from Persona.") unless $response->is_success;
    [2.451]
    [3.1420]
    error($c, "Did not get a response from Persona.") unless $response->is_success;
  • replacement in src/lib/Hydra/Controller/User.pm at line 91
    [2.613][2.613:701]()
    Catalyst::Exception->throw("Persona says: $d->{reason}") if $d->{status} ne "okay";
    [2.613]
    [3.24933]
    error($c, "Persona says: $d->{reason}") if $d->{status} ne "okay";
  • edit in src/lib/Hydra/Controller/User.pm at line 109
    [2.1113]
    [2.1113]
    $c->flash->{flashMsg} = "You are now signed in as <tt>" . $email . "</tt>";
    }
    sub persona_logout :Path('/persona-logout') Args(0) {
    my ($self, $c) = @_;
    $c->stash->{json} = {};
    requirePost($c);
    $c->flash->{flashMsg} = "You are no longer signed in." if $c->user_exists();
    $c->logout;
  • replacement in src/lib/Hydra/Helper/CatalystUtils.pm at line 92
    [3.3722][3.3722:3746]()
    my ($c, $msg) = @_;
    [3.3722]
    [3.3746]
    my ($c, $msg, $status) = @_;
    $c->response->status($status) if defined $status;
  • replacement in src/lib/Hydra/Helper/CatalystUtils.pm at line 101
    [3.4302][3.4302:4354]()
    $c->response->status(404);
    error($c, $msg);
    [3.4302]
    [3.4354]
    error($c, $msg, 404);
  • replacement in src/lib/Hydra/Helper/CatalystUtils.pm at line 116
    [3.4373][3.1245:1329](),[3.1245][3.1245:1329]()
    $c->response->redirect($c->uri_for('/login'));
    $c->detach; # doesn't return
    [3.4373]
    [3.1329]
    error($c, "This page requires you to sign in.", 403);
  • replacement in src/lib/Hydra/Helper/CatalystUtils.pm at line 132
    [3.1][3.1:89]()
    error($c, "Only the project members or administrators can perform this operation.")
    [3.1]
    [3.1955]
    error($c, "Only the project members or administrators can perform this operation.", 403)
  • edit in src/lib/Hydra/Helper/CatalystUtils.pm at line 139
    [3.2033][3.2033:2034]()
  • edit in src/lib/Hydra/Helper/CatalystUtils.pm at line 145
    [3.11226][3.11226:11227]()
  • replacement in src/lib/Hydra/Helper/CatalystUtils.pm at line 146
    [3.11269][3.2574:2575](),[3.2575][3.11274:11339](),[3.11274][3.11274:11339]()
    error($c, "Only administrators can perform this operation.")
    [3.11269]
    [3.2099]
    error($c, "Only administrators can perform this operation.", 403)
  • replacement in src/root/layout.tt at line 124
    [2.1899][2.1899:2148]()
    $.ajax({
    type: 'POST',
    url: '/logout',
    success: function(res, status, xhr) { window.location.reload(); },
    error: function(xhr, status, err) { alert("Logout failure: " + err); }
    });
    [2.1899]
    [2.2148]
    $.post("[% c.uri_for('/persona-logout') %]")
    .done(function(data) {
    window.location.reload();
    })
    .fail(function() { bootbox.alert("Server request failed!"); });