SSH into the UniFi. Note that the UniFi username and password get updated from the controller. Refer to here to find username and password.
run the syswrapper.sh script with the restore-default option
Once the device is reset, log in over ssh and reconfigure.
Note that the username and password will now be ubnt/ubnt