sort devices by portal name, *then* friendly name. fix crash when resetting password