we are going to fix this by automatically generating data for ppl that register HOWEVER, just in case that fails for some reason, I have applied a filter that ensures if some data is not associated with a person they cannot navigate to all aspects of the application. This is a preventive measure
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
class AdminController < ApplicationController
|
||||
|
||||
skip_before_filter :has_info
|
||||
|
||||
def dashboard
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
|
||||
before_filter :authenticated
|
||||
before_filter :authenticated, :has_info
|
||||
helper_method :current_user, :is_admin?
|
||||
|
||||
# Our security guy keep talking about sea-surfing, cool story bro.
|
||||
@@ -27,4 +27,18 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
end
|
||||
|
||||
def has_info
|
||||
redirect = false
|
||||
if current_user
|
||||
begin
|
||||
if !(current_user.retirement || current_user.paid_time_off.schedule || current_user.paid_time_off || current_user.work_info || current_user.performance)
|
||||
redirect = true
|
||||
end
|
||||
rescue
|
||||
redirect = true
|
||||
end
|
||||
end
|
||||
redirect_to home_dashboard_index_path if redirect
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
class DashboardController < ApplicationController
|
||||
|
||||
skip_before_filter :has_info
|
||||
|
||||
def home
|
||||
@user = current_user
|
||||
end
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class SessionsController < ApplicationController
|
||||
|
||||
skip_before_filter :has_info
|
||||
skip_before_filter :authenticated, :only => [:new, :create]
|
||||
|
||||
def new
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class TutorialsController < ApplicationController
|
||||
|
||||
skip_before_filter :has_info
|
||||
skip_before_filter :authenticated
|
||||
|
||||
def index
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
class UsersController < ApplicationController
|
||||
|
||||
skip_before_filter :has_info
|
||||
skip_before_filter :authenticated, :only => [:new, :create]
|
||||
|
||||
def new
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span12"> <!--begin span12 -->
|
||||
<% if @user.paid_time_off %>
|
||||
<%= render :partial => "layouts/dashboard/dashboard_stats"%>
|
||||
<% end %>
|
||||
</div> <!-- end span12 -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="widget">
|
||||
<div class="widget-header">
|
||||
<div class="title">
|
||||
<span class="fs1" aria-hidden="true" data-icon=""></span> Profile Settings
|
||||
<span class="fs1" aria-hidden="true" data-icon=""></span> Profile Settings
|
||||
<span class="mini-title">
|
||||
Edit your account details
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user