The easy method:
If your controller is installed on a 64bit operating system (default for recent versions), you should have no trouble following this method.
- Download Robo 3T from this link
- Install and create a profile for your local server, and port number 27117
- Connect to it, and in the left pane expand “ace” and then “collections”
- Right-click on “admin” and click “View documents”
- Open up this link to QuickHash.com
- In the “Input data” field, type the new password you would like to set, and in the “Salt” field type 9Ter1EZ9$lSt6 and click Generate and your new password hash will be shown in the output field.
- Copy the output value from QuickHash, and head back to Robo 3T to paste it in the “x_shadow” field.
- Head back to your UniFi login screen, unter your username and your new password and you should be straight in!
Source: How to reset UniFi controller admin password, without email, including 32bit – Rob’s Blog