add app_id and auth_token to employee

This commit is contained in:
Zin Moe
2020-01-14 14:58:23 +06:30
parent 48e6afa505
commit c5eb5d6678
7 changed files with 71 additions and 26 deletions

View File

@@ -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