Skip to content

Commit

Permalink
Merge pull request #283 from concord-consortium/auto-login-teachers-f…
Browse files Browse the repository at this point in the history
…or-preview

Added auto login for teachers when previewing an activity
  • Loading branch information
scytacki authored Jan 17, 2017
2 parents de4a6af + 634d359 commit b739bad
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/controllers/external_activities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,19 @@ def show
format.html {
redirect_to(browse_external_activity_path(@external_activity))
}
format.run_resource_html { redirect_to(@external_activity.url) }
format.run_resource_html {
# ensure that a logged in user is the same user on LARA
if !current_visitor.anonymous?
uri = URI.parse(@external_activity.url)
query = Rack::Utils.parse_query(uri.query)
query["domain"] = root_url
query["domain_uid"] = current_visitor.id
uri.query = Rack::Utils.build_query(query)
redirect_to(uri.to_s)
else
redirect_to(@external_activity.url)
end
}
format.xml { render xml: @external_activity }
format.json { render json: @external_activity }
end
Expand Down

0 comments on commit b739bad

Please sign in to comment.