Switched around the whole controller

found a cleaner way to implement the controller and now the registration
and login pages are working