Added missing fields from register form, added logic to handle failed
registering and login