Class: CustomerServiceIm::StaffsController
- Inherits:
-
ApplicationController
- Object
- ActionController::API
- ApplicationController
- CustomerServiceIm::StaffsController
- Defined in:
- app/controllers/customer_service_im/staffs_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#render_200, #render_401, #render_422, #render_500
Instance Method Details
#login ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'app/controllers/customer_service_im/staffs_controller.rb', line 4 def login staff = Staff.find_by!(email: params[:email]) if staff.authenticate(params[:password]) render_200 staff.as_json.merge({ token: token_user(staff) }) else render_401(errors: "邮箱或密码错误") end end |