Browse files

made oauth credentials configurable

  • Loading branch information...
1 parent 9c825d6 commit 7d56e33264995016ff860b049f005d05cc9f4a5e @monken monken committed Jul 12, 2011
Showing with 11 additions and 6 deletions.
  1. +5 −3 lib/MetaCPAN/Web/Controller/Login.pm
  2. +4 −1 metacpan_web.conf
  3. +1 −1 root/account/identities.html
  4. +1 −1 root/wrapper.html
View
8 lib/MetaCPAN/Web/Controller/Login.pm
@@ -11,9 +11,11 @@ sub index : Path {
return $c->detach('/not_found') unless ($code);
my $data
= $c->model('API')
- ->request(
- "/oauth2/access_token?client_id=metacpan&client_secret=ClearAirTurbulence&code=$code"
- )->recv;
+ ->request( "/oauth2/access_token?client_id="
+ . $c->config->{consumer_id}
+ . "&client_secret="
+ . $c->config->{consumer_secret}
+ . "&code=$code" )->recv;
$c->req->session->set( token => $data->{access_token} );
$c->authenticate( { token => $data->{access_token} } );
$c->res->redirect('/');
View
5 metacpan_web.conf
@@ -4,6 +4,8 @@ name MetaCPAN::Web
default_view HTML
api api.metacpan.org
+consumer_key = metacpan.dev
+consumer_secret = ClearAirTurbulence
<view HTML>
INCLUDE_PATH root/
@@ -20,4 +22,5 @@ api api.metacpan.org
<view Raw>
WRAPPER ""
-</view>
+</view>
+
View
2 root/account/identities.html
@@ -4,7 +4,7 @@
<br /><br />
<table width="300">
<% FOREACH identity IN ['Facebook', 'GitHub', 'PAUSE', 'Twitter']; found = user.identity.grep(->(a){ a.name == identity.lower }) %>
- <tr><td><big><% identity %></big></td><td><div class="ds"><% IF found.size %><a class="g-button" href="/account/identities?delete=<% identity.lower %>">Disconnect</a><% ELSE %><a class="g-button" href="http://<% api %>/oauth2/authorize?choice=<% identity.lower %>&amp;client_id=metacpan">Connect</a><% END %></ds></td></tr>
+ <tr><td><big><% identity %></big></td><td><div class="ds"><% IF found.size %><a class="g-button" href="/account/identities?delete=<% identity.lower %>">Disconnect</a><% ELSE %><a class="g-button" href="http://<% api %>/oauth2/authorize?choice=<% identity.lower %>&amp;client_id=<% c.config.consumer_key %>">Connect</a><% END %></ds></td></tr>
<% END %>
</table>
</div>
View
2 root/wrapper.html
@@ -55,7 +55,7 @@
<div id="signin" style="display: block; position: absolute; right: 2px; top: 0px">
<div style="border-color: #CCC #999 #fff #CCC; border-width: 1px; border-style: solid; position: relative; top: 1px; background-color: #fff; width: 50px; left: 30px; padding: 5px; text-align: right"><strong>Sign in</strong></div>
<div class="ds"><div style="border-color: #CCC #999 #999 #CCC; border-width: 1px; border-style: solid; background-color: #fff; width: 80px; padding: 5px;"><% FOREACH identity IN ['Facebook', 'GitHub', 'PAUSE', 'Twitter'] %>
- <a href="http://<% api %>/oauth2/authorize?choice=<% identity.lower %>&amp;client_id=metacpan"><% identity %></a><% END %>
+ <a href="http://<% api %>/oauth2/authorize?choice=<% identity.lower %>&amp;client_id=<% c.config.consumer_key %>"><% identity %></a><% END %>
</div></div><% END %>
</div>
<div style="float: right; text-align: right; padding-right: 5px; margin-top: -15px"><a href="https://github.com/CPAN-API/metacpan-web/issues/new"><small>Problem?<br>Open an issue!</small></a></div>

0 comments on commit 7d56e33

Please sign in to comment.