Added user authentication and fixed last user deleting bug