Welcome to iPhone Forums!
Did she forget a password (iCloud ID, e.g.), or the passcode?
If it was the passcode (the combination used to access/unlock the iPhone):
Restoring from a backup doesn’t restore the passcode.
In that case, it wouldn’t have been necessary to get a new device. Erasing the iPhone with the forgotten passcode and restoring it from a backup would work as well.
Just make sure to write down the new passcode right after creating it.
If she forgot the password for the iCloud ID:
That’s way more complicated, as an iDevice locked by Activation lock can’t be unlocked. In this case, she will have to visit the next Apple Store, make sure she can prove that she’s the owner of the device (billing), and ask for help.