added before filter to authenticate a user, added validations to posts model