In order to get rid of the codeand the lock completely and at the same time to reflash the phone, you will need to sync with your computer. Use data cable and driver. If it was not in the configuration, buy data cable for your phone model and download the drivers separately. Also, download the software for flashing of phone and version of factory firmware. Reboot the phone, then code blocking will disappear.
Contact the manufacturer of your phone. Prepare the documents proving your ownership of the phone. Remember that the more documents you submit, the faster you will be given the desired - codes on reset and firmware reset. Reset the firmware you need to completely clean the phone while the factory reset will reset all settings on standard. Also, request a standard code lock.
After you reset, go to settings and apply the standard code lock in order to disable it altogether. If you reset the firmware, disable the codeand lock in the settings is not required.