This happened to my wife's S7 edge phone too, with the phone getting warm and kept rebooting periodically. Here's a couple of things to try without having to perform a factory reset and losing your data.
1. Plug in a USB keyboard (using a Micro USB adapter) to enter your password.
2. Restart the phone in recovery mode and wipe the cache partition
Turn off the device, Press and hold the Volume Up key, Home key, and Power key at the same time, When the phone powers on, the Android System Recovery screen appears approx. 30 seconds later. Release all of the keys. Press the Volume down key to highlight "wipe cache partition." Press the Power key to select. Press the Volume down key to highlight “yes” and press thePower key to select. When the wipe cache partition is complete, “Reboot system now” is highlighted. Press the Power key to restart the device.
3. Plug it into a desktop and attempt to make an "112" emergency call. For some reason, plugging it into a desktop makes a difference.
Option 2 didn't work for me and as I didn't have a Micro USB adapter/keyboard on hand, I tried Option 3 and that finally worked to bring the keyboard back and getting back into the phone.
Once you're back into the phone, look for any 3rd party keyboards that's been installed (e.g. Swiftkey) and remove it. This looks like an issue that when the phone restarts requesting for a password, it's unable to bring up the 3rd party keyboard or switch to the default Samsung keyboard.