diff --git a/lib/two_factor_authentication/models/two_factor_authenticatable.rb b/lib/two_factor_authentication/models/two_factor_authenticatable.rb index eb6398c8..f5b94e96 100644 --- a/lib/two_factor_authentication/models/two_factor_authenticatable.rb +++ b/lib/two_factor_authentication/models/two_factor_authenticatable.rb @@ -92,7 +92,7 @@ def confirm_totp_secret(secret, code, options = {}) end def generate_totp_secret - ROTP::Base32.random_base32 + ROTP::Base32.try(:random) || ROTP::Base32.random_base32 end def create_direct_otp(options = {})