Add validation and CSRF for incoming data in controller/save_gate_state.
Add validation and CSRF for incoming data in controller/save_gate_state.