update base controllers

This commit is contained in:
Yan
2018-02-23 14:45:53 +06:30
parent 643a9d71be
commit 25a212bb70
10 changed files with 14 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
class BaseCrmController < ApplicationController
include LoginVerification
layout "CRM"
#before_action :check_installation

View File

@@ -1,4 +1,5 @@
class BaseInventoryController < ApplicationController
include LoginVerification
layout "inventory"
#before_action :check_installation

View File

@@ -1,4 +1,5 @@
class BaseOqsController < ApplicationController
include LoginVerification
layout "OQS"
#before_action :check_installation

View File

@@ -1,4 +1,5 @@
class BaseOrigamiController < ApplicationController
include LoginVerification
layout "origami"
# before_action :checkin_process

View File

@@ -1,4 +1,5 @@
class BaseReportController < ApplicationController
include LoginVerification
layout "application"
#before_action :check_installation

View File

@@ -1,4 +1,5 @@
class BaseWaiterController < ApplicationController
include LoginVerification
layout "waiter"
#before_action :check_installation

View File

@@ -13,7 +13,7 @@ module LicenseVerification
if (!@license.nil?)
# logger.info "Location - " + @license.name
ActiveRecord::Base.establish_connection(website_connection(@license))
authenticate_session_token
# authenticate_session_token
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
else
# reconnect_default_db
@@ -40,6 +40,7 @@ module LicenseVerification
@user = Employee.authenticate_by_token(token)
if !@user
flash[:notice] = 'Invalid Access!'
redirect_to root_path
end
end
end

View File

@@ -2,7 +2,7 @@ module LoginVerification
extend ActiveSupport::Concern
included do
before_action :authenticate
before_action :authenticate_session_token
helper_method :current_company,:current_login_employee
end
@@ -25,6 +25,7 @@ module LoginVerification
#Maybe log - login?
else
flash[:notice] = 'Invalid Access!'
# return false
end
end
end

View File

@@ -1,11 +1,12 @@
class HomeController < ApplicationController
include LoginVerification
# layout "application", except: [:index, :show]
# skip_before_action only: [:index, :show, :create, :update, :destroy]
def index
# @employees = Employee.all_emp_except_waiter.order("name asc")
@employees = Employee.all.order("name asc")
@login_form = LoginForm.new()
@login_form = LoginForm.new()
render "layouts/login_dashboard", layout: false
end
@@ -56,7 +57,7 @@ class HomeController < ApplicationController
render :index
end
else
redirect_to origami_root_path, :notice => "Username and Password doesn't match!"
redirect_to root_path, :notice => "Username and Password doesn't match!"
end
end

View File

@@ -1,4 +1,5 @@
class PrintSettingsController < ApplicationController
include LoginVerification
load_and_authorize_resource except: [:create]
before_action :set_print_setting, only: [:show, :edit, :update, :destroy]