fixed the oauth redirect bug and a bit more (#796)
This commit is contained in:
parent
4187dbd803
commit
d359eb063a
7 changed files with 53 additions and 19 deletions
|
@ -827,6 +827,9 @@ label {
|
|||
.accountAdmin .accountIcon {
|
||||
background-position: 0 -32px;
|
||||
}
|
||||
.accountApps .accountIcon {
|
||||
background-position: 0 -32px;
|
||||
}
|
||||
.accountInvite .accountIcon {
|
||||
background-position: 0 -64px;
|
||||
}
|
||||
|
|
|
@ -753,6 +753,11 @@
|
|||
top:5px;
|
||||
left:5px;
|
||||
}
|
||||
|
||||
.exploreMapsCenter .authedApps .exploreMapsIcon {
|
||||
background-image: url(<%= asset_data_uri('user_sprite.png') %>);
|
||||
background-position: 0 -32px;
|
||||
}
|
||||
.exploreMapsCenter .myMaps .exploreMapsIcon {
|
||||
background-image: url(<%= asset_path 'exploremaps_sprite.png' %>);
|
||||
background-position: -32px 0;
|
||||
|
@ -773,6 +778,9 @@
|
|||
background-image: url(<%= asset_path 'exploremaps_sprite.png' %>);
|
||||
background-position: -96px 0;
|
||||
}
|
||||
.authedApps:hover .exploreMapsIcon, .authedApps.active .exploreMapsIcon {
|
||||
background-position-x: -32px;
|
||||
}
|
||||
.myMaps:hover .exploreMapsIcon, .myMaps.active .exploreMapsIcon {
|
||||
background-position: -32px -32px;
|
||||
}
|
||||
|
|
|
@ -1,2 +1,14 @@
|
|||
class Users::SessionsController < Devise::SessionsController
|
||||
protected
|
||||
|
||||
def after_sign_in_path_for(resource)
|
||||
stored = stored_location_for(User)
|
||||
return stored if stored
|
||||
|
||||
if request.referer&.match(sign_in_url) || request.referer&.match(sign_up_url)
|
||||
super
|
||||
else
|
||||
request.referer || root_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,6 +5,12 @@
|
|||
</header>
|
||||
|
||||
<main role="main">
|
||||
<div>
|
||||
Coming soon!<br />
|
||||
There are a number of apps being worked on for Metamaps currently, including the playful Metamapper Slack Bot. Check back here for updates.<br />
|
||||
If you're a developer interested in building an app for Metamaps, check out <a href="https://metamaps.cc/api" target="_blank">the API docs</a>.
|
||||
</div><br />
|
||||
<% if @applications.count > 0 %>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -24,6 +30,7 @@
|
|||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
<div class="accountIcon"></div>
|
||||
<span>Share Invite</span>
|
||||
</li>
|
||||
<li class="accountListItem accountApps">
|
||||
<div class="accountIcon"></div>
|
||||
<%= link_to "Apps", oauth_authorized_applications_path %>
|
||||
</li>
|
||||
<li class="accountListItem accountLogout">
|
||||
<div class="accountIcon"></div>
|
||||
<%= link_to "Sign Out", "/logout", id: "Logout" %>
|
||||
|
|
|
@ -9,14 +9,10 @@
|
|||
|
||||
<body class="<%= current_user ? 'authenticated' : 'unauthenticated' %>">
|
||||
|
||||
<% if devise_error_messages? %>
|
||||
<p id="toast"><%= devise_error_messages! %></p>
|
||||
<% elsif notice %>
|
||||
<p id="toast"><%= notice %></p>
|
||||
<% end %>
|
||||
<a class='feedback-icon' target='_blank' href='https://hylo.com/c/metamaps'></a>
|
||||
|
||||
<%= content_tag :div, class: "main" do %>
|
||||
|
||||
|
||||
<% if params[:controller] == 'doorkeeper/applications' || params[:controller] == 'doorkeeper/authorized_applications'
|
||||
classes = 'appsPage'
|
||||
else
|
||||
|
@ -30,24 +26,16 @@
|
|||
|
||||
<%= yield %>
|
||||
|
||||
<div class="showcard mapElement mapElementHidden" id="showcard"></div> <!-- the topic card -->
|
||||
<% if current_user %>
|
||||
<% # for creating and pulling in topics and synapses %>
|
||||
<%= render :partial => 'maps/newtopic' %>
|
||||
<%= render :partial => 'maps/newsynapse' %>
|
||||
<% # for populating the change metacode list on the topic card %>
|
||||
<%= render :partial => 'shared/metacodeoptions' %>
|
||||
<% end %>
|
||||
<%= render :partial => 'layouts/lowermapelements' %>
|
||||
|
||||
<div id="exploreMapsHeader">
|
||||
<div class="exploreMapsBar exploreElement">
|
||||
<div class="exploreMapsMenu">
|
||||
<div class="exploreMapsCenter">
|
||||
<% if current_user && current_user.admin %>
|
||||
<a href="<%= oauth_applications_path %>" class="activeMaps exploreMapsButton <%= params[:controller] == 'doorkeeper/applications' ? 'active' : nil %>">
|
||||
<div class="exploreMapsIcon"></div>Registered Apps
|
||||
</a>
|
||||
<a href="<%= oauth_authorized_applications_path %>" class="activeMaps exploreMapsButton <%= params[:controller] == 'doorkeeper/authorized_applications' ? 'active' : nil %>">
|
||||
<% end %>
|
||||
<a href="<%= oauth_authorized_applications_path %>" class="authedApps exploreMapsButton <%= params[:controller] == 'doorkeeper/authorized_applications' ? 'active' : nil %>">
|
||||
<div class="exploreMapsIcon"></div>Authorized Apps
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -5,13 +5,25 @@ Doorkeeper.configure do
|
|||
|
||||
# This block will be called to check whether the resource owner is authenticated or not.
|
||||
resource_owner_authenticator do
|
||||
current_user || redirect_to(sign_in_url)
|
||||
if current_user
|
||||
current_user
|
||||
else
|
||||
store_location_for(User, request.fullpath)
|
||||
redirect_to(sign_in_url, notice: "Sign In to Connect")
|
||||
end
|
||||
end
|
||||
|
||||
# If you want to restrict access to the web interface for adding oauth authorized applications,
|
||||
# you need to declare the block below.
|
||||
admin_authenticator do
|
||||
current_user || redirect_to(sign_in_url)
|
||||
if current_user && current_user.admin
|
||||
current_user
|
||||
elsif current_user && !current_user.admin
|
||||
redirect_to(root_url, notice: "Unauthorized")
|
||||
else
|
||||
store_location_for(User, request.fullpath)
|
||||
redirect_to(sign_in_url, notice: "Try signing in to do that")
|
||||
end
|
||||
end
|
||||
|
||||
# Authorization Code expiration time (default 10 minutes).
|
||||
|
|
Loading…
Reference in a new issue