Add basic Persona support
[?]
Jul 8, 2013, 9:54 PM
36ZTCZ4FDV6ILURQEIGFHCP57ALZH6OWYNN3MBXG2QXZSBULBPMACDependencies
- [2]
7KF7YZDRDisable account creation for now - [3]
RFGPN7U7Machine status: Don't show removed machines anymore - [4]
S5GCSCNSUpdate bootstrap to 2.3.1 - [5]
DV43UILUDon't float the search bar to the right in collapsed mode - [6]
LZVO64YGMerge in the first bits of the API work - [7]
QL55ECJ6- adapted ui for hydra, more in line with nixos.org website - [8]
UICHT2PSAdd a search feature - [9]
OEPUOUNBUsing twitter bootstrap for more consistent looks for Hydra - [10]
JARRBLZDBootstrapify the Hydra forms (except the project and jobset edit pages) - [11]
XJRJ4J7MAdd user registration - [12]
HTL6HIBMmachine-status: Read /etc/nix.machines instead of using the BuildMachines table - [13]
BZUB3ZSHUse get_column for 'as' column (max_stoptime). - [*]
J5UVLXOK* Start of a basic Catalyst web interface. - [*]
PZL3SZM3Give every page a consistent title - [*]
HRAFVVOEmake logo configurable via HYDRA_LOGO env var - [*]
RU7AQO7U* Role-based access control. Only admins can create projects. Only
Change contents
- replacement in src/lib/Hydra/Controller/Root.pm at line 138
- edit in src/lib/Hydra/Controller/User.pm at line 11
use LWP::UserAgent;use JSON; - edit in src/lib/Hydra/Controller/User.pm at line 73
sub persona_login :Path('/persona-login') Args(0) {my ($self, $c) = @_;$c->stash->{json} = {};die if $c->request->method ne "POST";my $assertion = $c->req->params->{assertion} or die;my $ua = new LWP::UserAgent;my $response = $ua->post('https://verifier.login.persona.org/verify',{ assertion => $assertion,audience => "http://localhost:3000/"});Catalyst::Exception->throw("Did not get a response from Persona.") unless $response->is_success; - edit in src/lib/Hydra/Controller/User.pm at line 90
my $d = decode_json($response->decoded_content) or die;Catalyst::Exception->throw("Persona says: $d->{reason}") if $d->{status} ne "okay"; - edit in src/lib/Hydra/Controller/User.pm at line 93
my $email = $d->{email} or die;my $user = $c->find_user({ username => $email });if (!$user) {$c->model('DB::Users')->create({ username => $email, password => "!", emailaddress => $email,});$user = $c->find_user({ username => $email }) or die;}$c->set_authenticated($user);$c->stash->{json}->{result} = "ok";} - edit in src/root/layout.tt at line 13
<meta http-equiv="X-UA-Compatible" content="IE=Edge" /> - replacement in src/root/layout.tt at line 100
You are logged in as <tt>[% c.user.username %]</tt>.You are logged in as <tt>[% HTML.escape(c.user.username) %]</tt>. - edit in src/root/layout.tt at line 106
<script src="https://login.persona.org/include.js"></script><script>navigator.id.watch({loggedInUser: [% c.user_exists ? '"' _ HTML.escape(c.user.username) _ '"' : "null" %],onlogin: function(assertion) {$.post("[% c.uri_for('/persona-login') %]", { assertion: assertion }).done(function(data) {if (data.error)bootbox.alert("Login failed: " + data.error);elsewindow.location.reload();}).fail(function() { bootbox.alert("Server request failed!"); });},onlogout: function() {$.ajax({type: 'POST',url: '/logout',success: function(res, status, xhr) { window.location.reload(); },error: function(xhr, status, err) { alert("Logout failure: " + err); }});}}); - edit in src/root/layout.tt at line 132
$("#persona-signin").click(function() {navigator.id.request();});$("#persona-signout").click(function() {navigator.id.logout();});</script> - edit in src/root/login.tt at line 15
<br/> - edit in src/root/login.tt at line 16
<!-- - edit in src/root/login.tt at line 40[18.5199][18.5199]
--> - replacement in src/root/topbar.tt at line 3
<a href="[% uri %]">[% title %]</a><a [% HTML.attributes(href => uri) %]>[% title %]</a> - replacement in src/root/topbar.tt at line 201
[% INCLUDE menuItem uri = c.uri_for(c.controller('Root').action_for('logout')) title = "Sign out" %]<li><a href="#" id="persona-signout">Sign out</a></li> - replacement in src/root/topbar.tt at line 205
[% INCLUDE menuItem uri = c.uri_for(c.controller('Root').action_for('login')) title = "Sign in" %]<li><a href="#" id="persona-signin">Sign in</a></li>