Generate verify account email token/key for testing verify-account request #285
-
Hello, I have been testing my app with rodauth functionality via requests. I recently delegated the whole "complete account registration" for the verify action. I want to test this verify-account action, but I can't figure out how to get access to the key param needed. I've tried a number of approaches: 2.- Using rodauth instance: def verify_account_key(unverified_account_email)
unverified_account = Account.find_by(email: unverified_account_email)
rodauth = Rodauth::Rails.rodauth(account: unverified_account)
unverified_account.verification_key.key # -> this returns the key correctly
rodauth.verify_account_email_link # -> this returns the link with only the account ID as the key (ID_)
end And the output:
Is there way I could handle this? I can't think of any other rodauth methods available for getting the correct key. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
I had the same exact question a few months ago. I'll see if I can find it. |
Beta Was this translation helpful? Give feedback.
-
Found it! #254 (comment) |
Beta Was this translation helpful? Give feedback.
-
You can set the rodauth = Rodauth::Rails.rodauth(account: unverified_account)
rodauth.instance_variable_set(:@verify_account_key_value, unverified_account.verification_key.key)
rodauth.verify_account_email_link |
Beta Was this translation helpful? Give feedback.
Thanks for your contribution! I guess you too went for a mail-checking solution, sadly unavailable for me.
I did solve it tho, by replicating the rodauth implementation on simple aux method. It isn't pretty but it works for me.