update token mismatch
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
class BaseCrmController < ApplicationController
|
class BaseCrmController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
layout "CRM"
|
layout "CRM"
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class BaseInventoryController < ApplicationController
|
class BaseInventoryController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
layout "inventory"
|
layout "inventory"
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class BaseOqsController < ApplicationController
|
class BaseOqsController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
layout "OQS"
|
layout "OQS"
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class BaseOrigamiController < ApplicationController
|
class BaseOrigamiController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
layout "origami"
|
layout "origami"
|
||||||
|
|
||||||
# before_action :checkin_process
|
# before_action :checkin_process
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class BaseReportController < ApplicationController
|
class BaseReportController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
layout "application"
|
layout "application"
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class BaseWaiterController < ApplicationController
|
class BaseWaiterController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
layout "waiter"
|
layout "waiter"
|
||||||
|
|
||||||
#before_action :check_installation
|
#before_action :check_installation
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ module LicenseVerification
|
|||||||
# redirect_to activate_path
|
# redirect_to activate_path
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
authenticate_session_token
|
||||||
end
|
end
|
||||||
|
|
||||||
def authenticate_session_token
|
def authenticate_session_token
|
||||||
@@ -38,9 +39,12 @@ module LicenseVerification
|
|||||||
#Rails.logger.debug "token - " + token.to_s
|
#Rails.logger.debug "token - " + token.to_s
|
||||||
|
|
||||||
@user = Employee.authenticate_by_token(token)
|
@user = Employee.authenticate_by_token(token)
|
||||||
if !@user
|
if @user
|
||||||
|
return true
|
||||||
|
#Maybe log - login?
|
||||||
|
else
|
||||||
flash[:notice] = 'Invalid Access!'
|
flash[:notice] = 'Invalid Access!'
|
||||||
redirect_to root_path
|
# return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,6 +6,21 @@ module LoginVerification
|
|||||||
helper_method :current_company,:current_login_employee
|
helper_method :current_company,:current_login_employee
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#this is base api base controller to need to inherit.
|
||||||
|
#all token authentication must be done here
|
||||||
|
#response format must be set to JSON
|
||||||
|
def current_company
|
||||||
|
begin
|
||||||
|
return Company.first
|
||||||
|
rescue
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def current_login_employee
|
||||||
|
@employee = Employee.find_by_token_session(session[:session_token])
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
# Authenticate the user with token based authentication
|
# Authenticate the user with token based authentication
|
||||||
@@ -34,23 +49,6 @@ module LoginVerification
|
|||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
#this is base api base controller to need to inherit.
|
|
||||||
#all token authentication must be done here
|
|
||||||
#response format must be set to JSON
|
|
||||||
def current_company
|
|
||||||
begin
|
|
||||||
return Company.first
|
|
||||||
rescue
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
def current_login_employee
|
|
||||||
@employee = Employee.find_by_token_session(session[:session_token])
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
def check_license
|
def check_license
|
||||||
License.check_license_file
|
License.check_license_file
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class HomeController < ApplicationController
|
class HomeController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
# layout "application", except: [:index, :show]
|
# layout "application", except: [:index, :show]
|
||||||
# skip_before_action only: [:index, :show, :create, :update, :destroy]
|
# skip_before_action only: [:index, :show, :create, :update, :destroy]
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class PrintSettingsController < ApplicationController
|
class PrintSettingsController < ApplicationController
|
||||||
include LoginVerification
|
|
||||||
load_and_authorize_resource except: [:create]
|
load_and_authorize_resource except: [:create]
|
||||||
before_action :set_print_setting, only: [:show, :edit, :update, :destroy]
|
before_action :set_print_setting, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user