Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add separate secure external api config, and use it for oauth

  • Loading branch information...
commit ff44f3b30f2251c0a0af5befce3038854ca4be38 1 parent b0062d5
@haarg haarg authored
View
5 lib/MetaCPAN/Web/Controller/Root.pm
@@ -87,6 +87,11 @@ sub end : ActionClass('RenderView') {
$c->stash->{api_secure} = $c->config->{api_secure} || $c->config->{api};
$c->stash->{api_external}
= $c->config->{api_external} || $c->config->{api};
+ $c->stash->{api_external_secure}
+ = $c->config->{api_external_secure} || $c->config->{api_external}
+ || $c->stash->{api_secure};
+ $c->stash->{oauth_prefix} = $c->stash->{api_external_secure}
+ . '/oauth2/authorize?client_id=' . $c->config->{consumer_key};
$c->res->header( Vary => 'Cookie' );
unless (
View
1  metacpan_web.conf
@@ -6,6 +6,7 @@ default_view HTML
api = http://api.metacpan.org
api_external = http://api.metacpan.org
api_secure = https://api.metacpan.org
+api_external_secure = https://api.metacpan.org
consumer_key = metacpan.dev
consumer_secret = ClearAirTurbulence
View
2  root/account/identities.html
@@ -15,7 +15,7 @@ <h4 class="alert-heading">Information</h4>
<button type="submit" class="btn btn-block btn-danger"><i class="icon-remove icon-white"></i> Disconnect</a>
</form>
<%- ELSE %>
- <a class="btn btn-block btn-success" href="<% api_secure %>/oauth2/authorize?choice=<% identity.lower %>&amp;client_id=<% c.config.consumer_key %>" onclick="return logInPAUSE(this)"><i class="icon-share icon-white"></i> Connect</a>
+ <a class="btn btn-block btn-success" href="<% oauth_prefix %>&amp;choice=<% identity.lower %>" onclick="return logInPAUSE(this)"><i class="icon-share icon-white"></i> Connect</a>
<%- END %>
</td>
</tr>
View
2  root/account/profile.html
@@ -3,7 +3,7 @@
<% IF no_profile -%>
<div class="alert alert-error">
<h4 class="alert-heading">Error</h4>
- In order to change your profile you have to <a href="<% api_secure %>/oauth2/authorize?choice=pause&amp;client_id=<% c.config.consumer_key %>" onclick="return logInPAUSE(this)">connect your account to PAUSE</a>.
+ In order to change your profile you have to <a href="<% oauth_prefix %>&amp;choice=pause" onclick="return logInPAUSE(this)">connect your account to PAUSE</a>.
</div>
<% ELSE -%>
<form method="POST" action="" class="form-horizontal">
View
2  root/wrapper.html
@@ -116,7 +116,7 @@
<ul class="dropdown-menu">
<%- FOREACH identity IN ['Facebook', 'GitHub', 'Twitter', 'Google'] %>
<li>
- <a href="<% api_secure %>/oauth2/authorize?choice=<% identity.lower %>&amp;client_id=<% c.config.consumer_key %>" onclick="return logInPAUSE(this)"><% identity %></a>
+ <a href="<% oauth_prefix %>&amp;choice=<% identity.lower %>" onclick="return logInPAUSE(this)"><% identity %></a>
</li>
<%- END %>
</ul>
Please sign in to comment.
Something went wrong with that request. Please try again.