employee login and authentication with session
This commit is contained in:
@@ -28,11 +28,9 @@ class Settings::EmployeesController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
if @employee.save
|
||||
format.html { redirect_to @employee, notice: 'Employee was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @employee }
|
||||
format.html { redirect_to settings_employees_path, notice: 'Employee was successfully created.' }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @employee.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -42,11 +40,9 @@ class Settings::EmployeesController < ApplicationController
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @employee.update(employee_params)
|
||||
format.html { redirect_to @employee, notice: 'Employee was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @employee }
|
||||
format.html { redirect_to settings_employee_path(@employee), notice: 'Employee was successfully updated.' }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @employee.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -56,8 +52,7 @@ class Settings::EmployeesController < ApplicationController
|
||||
def destroy
|
||||
@employee.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
format.html { redirect_to settings_employees_url, notice: 'Employee was successfully destroyed.' }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -69,6 +64,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, :password)
|
||||
params.require(:employee).permit(:name, :role, :emp_id, :password)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user