Erase/Restore iPhone without password?

Long story short, I broke my phone so a friend of a friend of a friend or something like that was able to give me their old iPhone 5. I booted it up and it doesn't have a screen lock passcode, but when I went to erase the phone to remove their personal information, it asks for a password. I've tried to ask them about it but they have no idea what the password is, and the email it's connected to isn't in use anymore. Is there any way to override this?

Added (1). *edit: I've tried to restore on the computer, but it says I must turn "find my iPhone" off. I can't turn it off because it needs the password.

Without the Apple ID and password, you are out of luck. What's the point of security if you can easily override it?