Refactor to allow sign in page to be called externally