Merge branch 'foodcourt' of gitlab.com:code2lab/SXRestaurant into foodcourt
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class Settings::EmployeesController < ApplicationController
|
||||
load_and_authorize_resource
|
||||
before_action :set_employee, only: [:show, :edit, :update, :destroy]
|
||||
before_action :set_employee, only: [:show, :edit, :update, :destroy, :change_auth_token]
|
||||
|
||||
|
||||
# GET /employees
|
||||
@@ -38,6 +38,13 @@ class Settings::EmployeesController < ApplicationController
|
||||
format.html { render :new }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def change_auth_token
|
||||
@employee.auth_token = SecureRandom.hex(10)
|
||||
@employee.save
|
||||
flash[:notice] = 'Auth Token was successfully updated.'
|
||||
redirect_to settings_employee_url(@employee)
|
||||
end
|
||||
|
||||
# PATCH/PUT /employees/1
|
||||
@@ -71,6 +78,6 @@ class Settings::EmployeesController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def employee_params
|
||||
params.require(:employee).permit(:name, :role, :is_active, :emp_id, :password,:order_queue_station_id, :image_path)
|
||||
params.require(:employee).permit(:name, :role, :is_active, :emp_id, :password,:order_queue_station_id, :image_path, :app_id, :auth_token)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user