Ubiquiti recently announced that a virus is forcing equipment offline and resetting them to factory default settings. The virus infects devices by coming through ports 80/443 and auto loading a script. It does NOT require any authentication because it is able to take advantage of an exploit in out-of-date firmware. This chart will explain which firmware version you should upgrade to, ASAP.
Ubiquiti has also issued a removal too, which is available here. This tool is able diagnose and fix the problem, as well as upgrading certain radios to an up-to-date firmware that will disable the script. If you are unable to access the device then you will need to do a TFTP recover to repair your device, which can be shown here. The link also includes a video tutorial on how to perform the reset procedure.