added login query for security, update function for CommonDAO