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 {
|
.accountAdmin .accountIcon {
|
||||||
background-position: 0 -32px;
|
background-position: 0 -32px;
|
||||||
}
|
}
|
||||||
|
.accountApps .accountIcon {
|
||||||
|
background-position: 0 -32px;
|
||||||
|
}
|
||||||
.accountInvite .accountIcon {
|
.accountInvite .accountIcon {
|
||||||
background-position: 0 -64px;
|
background-position: 0 -64px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -753,6 +753,11 @@
|
||||||
top:5px;
|
top:5px;
|
||||||
left:5px;
|
left:5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.exploreMapsCenter .authedApps .exploreMapsIcon {
|
||||||
|
background-image: url(<%= asset_data_uri('user_sprite.png') %>);
|
||||||
|
background-position: 0 -32px;
|
||||||
|
}
|
||||||
.exploreMapsCenter .myMaps .exploreMapsIcon {
|
.exploreMapsCenter .myMaps .exploreMapsIcon {
|
||||||
background-image: url(<%= asset_path 'exploremaps_sprite.png' %>);
|
background-image: url(<%= asset_path 'exploremaps_sprite.png' %>);
|
||||||
background-position: -32px 0;
|
background-position: -32px 0;
|
||||||
|
@ -773,6 +778,9 @@
|
||||||
background-image: url(<%= asset_path 'exploremaps_sprite.png' %>);
|
background-image: url(<%= asset_path 'exploremaps_sprite.png' %>);
|
||||||
background-position: -96px 0;
|
background-position: -96px 0;
|
||||||
}
|
}
|
||||||
|
.authedApps:hover .exploreMapsIcon, .authedApps.active .exploreMapsIcon {
|
||||||
|
background-position-x: -32px;
|
||||||
|
}
|
||||||
.myMaps:hover .exploreMapsIcon, .myMaps.active .exploreMapsIcon {
|
.myMaps:hover .exploreMapsIcon, .myMaps.active .exploreMapsIcon {
|
||||||
background-position: -32px -32px;
|
background-position: -32px -32px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,14 @@
|
||||||
class Users::SessionsController < Devise::SessionsController
|
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
|
end
|
||||||
|
|
|
@ -5,6 +5,12 @@
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main role="main">
|
<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">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -24,6 +30,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<% end %>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
<div class="accountIcon"></div>
|
<div class="accountIcon"></div>
|
||||||
<span>Share Invite</span>
|
<span>Share Invite</span>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="accountListItem accountApps">
|
||||||
|
<div class="accountIcon"></div>
|
||||||
|
<%= link_to "Apps", oauth_authorized_applications_path %>
|
||||||
|
</li>
|
||||||
<li class="accountListItem accountLogout">
|
<li class="accountListItem accountLogout">
|
||||||
<div class="accountIcon"></div>
|
<div class="accountIcon"></div>
|
||||||
<%= link_to "Sign Out", "/logout", id: "Logout" %>
|
<%= link_to "Sign Out", "/logout", id: "Logout" %>
|
||||||
|
|
|
@ -9,11 +9,7 @@
|
||||||
|
|
||||||
<body class="<%= current_user ? 'authenticated' : 'unauthenticated' %>">
|
<body class="<%= current_user ? 'authenticated' : 'unauthenticated' %>">
|
||||||
|
|
||||||
<% if devise_error_messages? %>
|
<a class='feedback-icon' target='_blank' href='https://hylo.com/c/metamaps'></a>
|
||||||
<p id="toast"><%= devise_error_messages! %></p>
|
|
||||||
<% elsif notice %>
|
|
||||||
<p id="toast"><%= notice %></p>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= content_tag :div, class: "main" do %>
|
<%= content_tag :div, class: "main" do %>
|
||||||
|
|
||||||
|
@ -30,24 +26,16 @@
|
||||||
|
|
||||||
<%= yield %>
|
<%= 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 id="exploreMapsHeader">
|
||||||
<div class="exploreMapsBar exploreElement">
|
<div class="exploreMapsBar exploreElement">
|
||||||
<div class="exploreMapsMenu">
|
<div class="exploreMapsMenu">
|
||||||
<div class="exploreMapsCenter">
|
<div class="exploreMapsCenter">
|
||||||
|
<% if current_user && current_user.admin %>
|
||||||
<a href="<%= oauth_applications_path %>" class="activeMaps exploreMapsButton <%= params[:controller] == 'doorkeeper/applications' ? 'active' : nil %>">
|
<a href="<%= oauth_applications_path %>" class="activeMaps exploreMapsButton <%= params[:controller] == 'doorkeeper/applications' ? 'active' : nil %>">
|
||||||
<div class="exploreMapsIcon"></div>Registered Apps
|
<div class="exploreMapsIcon"></div>Registered Apps
|
||||||
</a>
|
</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
|
<div class="exploreMapsIcon"></div>Authorized Apps
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,13 +5,25 @@ Doorkeeper.configure do
|
||||||
|
|
||||||
# This block will be called to check whether the resource owner is authenticated or not.
|
# This block will be called to check whether the resource owner is authenticated or not.
|
||||||
resource_owner_authenticator do
|
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
|
end
|
||||||
|
|
||||||
# If you want to restrict access to the web interface for adding oauth authorized applications,
|
# If you want to restrict access to the web interface for adding oauth authorized applications,
|
||||||
# you need to declare the block below.
|
# you need to declare the block below.
|
||||||
admin_authenticator do
|
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
|
end
|
||||||
|
|
||||||
# Authorization Code expiration time (default 10 minutes).
|
# Authorization Code expiration time (default 10 minutes).
|
||||||
|
|
Loading…
Reference in a new issue