put login flow control in the js plugin