built controller function to validate singup input and create new account in database