added validation of user logged in