Sha256: 7b0b868816138452b25522d068aa613c499ea80586933af85eec6707e30a90a7
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
module GoogleAuthenticatorRails # :nodoc: module ActiveRecord # :nodoc: module Helpers def set_google_secret self.__send__("#{self.class.google_secret_column}=", GoogleAuthenticatorRails::generate_secret) save end def google_authentic?(code) GoogleAuthenticatorRails.valid?(code, google_secret_value) end def google_qr_uri GoogleQR.new(:data => ROTP::TOTP.new(google_secret_value, :issuer => google_issuer).provisioning_uri(google_label), :size => "200x200").to_s end def google_label method = self.class.google_label_method case method when Proc method.call(self) when Symbol, String self.__send__(method) else raise NoMethodError.new("the method used to generate the google_label was never defined") end end def google_token_value self.__send__(self.class.google_lookup_token) end private def default_google_label_method self.__send__(self.class.google_label_column) end def google_secret_value self.__send__(self.class.google_secret_column) end def google_issuer self.class.google_issuer end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
google-authenticator-rails-0.0.9 | lib/google-authenticator-rails/active_record/helpers.rb |