I had the same problem with 2 switches purchased from a third party. Could not log in as I did not know the login credentials.
This worked for me:
1. Connect via console and run terminal program
2. Browse the menu on the front panel and do factory reset. It should say 'Resetting in progress'
3. Wait for 1-2 minutes
4. Press enter several times at the login screen
5. Type in 'root' as a username and press enter
6. Type 'cli' and press enter
7. Type 'request system zeroize' and press enter
8. Acknowledge system reset request
9. Wait until switch reboots