Bring out login logic from controller to router (also action-method of controller has been renamed)