1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-02 13:15:27 +00:00

Frontend authentication working.

This commit is contained in:
2016-04-28 01:13:58 +00:00
parent 84578d89da
commit 425e7f5fc5
18 changed files with 175 additions and 89 deletions

View File

@@ -3,8 +3,21 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
after_filter :set_csrf_cookie_for_ng
def set_csrf_cookie_for_ng
cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?
end
rescue_from CanCan::AccessDenied do |exception|
# flash[:error] = "Access denied!"
redirect_to '/static_pages/not_allowed'
end
protected
# In Rails 4.2 and above
def verified_request?
super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])
end
end

View File

@@ -1,7 +1,7 @@
json.cache! ["api_tournament", @tournament] do
json.content(@tournament)
json.(@tournament, :id, :name, :address, :director, :director_email, :tournament_type, :created_at, :updated_at)
json.(@tournament, :id, :name, :address, :director, :director_email, :tournament_type, :created_at, :updated_at, :user_id)
json.schools @tournament.schools do |school|
json.name school.name
@@ -28,8 +28,6 @@ json.cache! ["api_tournament", @tournament] do
json.mats @tournament.mats do |mat|
json.name mat.name
json.unfinishedMatches mat.unfinishedMatches do |match|
json.w1 = match.w1
json.w2 = match.w2
json.bout_number match.bout_number
json.w1_name match.w1_name
json.w2_name match.w2_name
@@ -42,8 +40,6 @@ json.cache! ["api_tournament", @tournament] do
json.w2_name match.w2_name
json.weightClass match.weight.max
json.round match.round
json.w1 = match.w1
json.w2 = match.w2
end
json.matches @tournament.matches do |match|
@@ -52,7 +48,7 @@ json.cache! ["api_tournament", @tournament] do
json.w2_name match.w2_name
json.weightClass match.weight.max
json.round match.round
json.w1 = match.w1
json.w2 = match.w2
json.w1 match.w1
json.w2 match.w2
end
end

View File

@@ -9,7 +9,7 @@
<script src="https://cdn.datatables.net/1.10.6/js/jquery.dataTables.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.map"></script>
<!--Mobile and tablet detection-->
<script type='text/javascript' src="//wurfl.io/wurfl.js"></script>