add expiry for login
This commit is contained in:
@@ -228,6 +228,9 @@ For Price 0 in receipt bill
|
|||||||
For Aston Request => Gift Voucher
|
For Aston Request => Gift Voucher
|
||||||
1) settings/payment_method_settings => {payment_method:'GiftVoucher', is_active:true, ...}
|
1) settings/payment_method_settings => {payment_method:'GiftVoucher', is_active:true, ...}
|
||||||
|
|
||||||
|
For Login expiry time
|
||||||
|
1) settings/lookups => {type:expity_time, name:login, value: {minutes}}
|
||||||
|
* value should be minute only (30 / 60 / 120 / etc.)
|
||||||
|
|
||||||
Menu Image (Import guideline)
|
Menu Image (Import guideline)
|
||||||
|
|
||||||
|
|||||||
@@ -134,8 +134,7 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
accounts = TaxProfile.where("group_type = ?","cashier").order("order_by ASC")
|
accounts = TaxProfile.where("group_type = ?","cashier").order("order_by ASC")
|
||||||
@tax_arr =[]
|
@tax_arr =[]
|
||||||
accounts.each do |acc|
|
accounts.each do |acc|
|
||||||
account = TaxProfile.find(acc.id)
|
@tax_arr.push(acc.name)
|
||||||
@tax_arr.push(account.name)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
lookup_spit_bill = Lookup.collection_of('split_bill')
|
lookup_spit_bill = Lookup.collection_of('split_bill')
|
||||||
|
|||||||
@@ -160,7 +160,6 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
accounts = TaxProfile.where("group_type = ?","cashier").order("order_by ASC")
|
accounts = TaxProfile.where("group_type = ?","cashier").order("order_by ASC")
|
||||||
@tax_arr =[]
|
@tax_arr =[]
|
||||||
accounts.each do |acc|
|
accounts.each do |acc|
|
||||||
account = TaxProfile.find(acc.id)
|
|
||||||
@tax_arr.push(account.name)
|
@tax_arr.push(account.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,12 @@ class Employee < ApplicationRecord
|
|||||||
|
|
||||||
def self.login(emp_id, password)
|
def self.login(emp_id, password)
|
||||||
user = Employee.find_by_emp_id(emp_id)
|
user = Employee.find_by_emp_id(emp_id)
|
||||||
|
expiry_time = login_expiry_time
|
||||||
if (user)
|
if (user)
|
||||||
#user.authenticate(password)
|
#user.authenticate(password)
|
||||||
|
|
||||||
if (user.authenticate(password))
|
if (user.authenticate(password))
|
||||||
user.generate_token
|
user.generate_token
|
||||||
user.session_expiry = DateTime.now.utc + 30.minutes
|
user.session_expiry = DateTime.now.utc + expiry_time.minutes
|
||||||
user.session_last_login = DateTime.now.utc
|
user.session_last_login = DateTime.now.utc
|
||||||
user.save
|
user.save
|
||||||
return user
|
return user
|
||||||
@@ -41,9 +41,10 @@ class Employee < ApplicationRecord
|
|||||||
def self.authenticate_by_token(session_token)
|
def self.authenticate_by_token(session_token)
|
||||||
if (session_token)
|
if (session_token)
|
||||||
user = Employee.find_by_token_session(session_token)
|
user = Employee.find_by_token_session(session_token)
|
||||||
|
expiry_time = login_expiry_time
|
||||||
if user && user.session_expiry.utc > DateTime.now.utc
|
if user && user.session_expiry.utc > DateTime.now.utc
|
||||||
#Extend the login time each time authenticatation take place
|
#Extend the login time each time authenticatation take place
|
||||||
user.session_expiry = user.session_expiry.utc + 30.minutes
|
user.session_expiry = user.session_expiry.utc + expiry_time.minutes
|
||||||
user.save
|
user.save
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
@@ -72,5 +73,17 @@ class Employee < ApplicationRecord
|
|||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.login_expiry_time
|
||||||
|
expiry_time = 30
|
||||||
|
login_expiry = Lookup.collection_of('expiry_time')
|
||||||
|
if !login_expiry.empty?
|
||||||
|
login_expiry.each do |exp_time|
|
||||||
|
if exp_time[0].downcase == "login"
|
||||||
|
expiry_time = exp_time[1].to_i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return expiry_time
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace :clear do
|
|||||||
PaymentJournal.delete_all
|
PaymentJournal.delete_all
|
||||||
Survey.delete_all
|
Survey.delete_all
|
||||||
ProductCommission.delete_all
|
ProductCommission.delete_all
|
||||||
|
InDuty.delete_all
|
||||||
DiningFacility.update_all(status:'available')
|
DiningFacility.update_all(status:'available')
|
||||||
CashierTerminal.update_all(is_currently_login: 0)
|
CashierTerminal.update_all(is_currently_login: 0)
|
||||||
SeedGenerator.where("id > 1").update(:current => 0, :next => 1)
|
SeedGenerator.where("id > 1").update(:current => 0, :next => 1)
|
||||||
|
|||||||
Reference in New Issue
Block a user