I am assuming that you have 2 different widgets. The first generates the “random” password and the second widget has a editable text that checks that you to enter in the same password?
If this is correct, then you will just need to store the password somewhere that is persistent for your game (playerCharacter, GameInstance etc). Once stored, you then can retrieve this password to check against your editable text.
For example, here I store the password in my game instance.
Then when someone commits changes to the editable text widget, I check against the password from the game instance: