Sha256: 269d36a04b5f526107f0d0f2aa6ac342007616e8622d816f1a392c48e3f1cb70

Contents?: true

Size: 1.81 KB

Versions: 3

Compression:

Stored size: 1.81 KB

Contents

# frozen_string_literal: true

require "composable/core"
require_relative "pwdless/version"
require "composable/pwdless/engine"

module Composable
  module Pwdless
    class Error < StandardError; end
    # Your code goes here...

    # The parent controller all Composable::Pwdless controllers inherits from.
    # Defaults to ApplicationController. This should be set early
    # in the initialization process and should be set to a string.
    mattr_accessor :parent_controller
    @@parent_controller = "ApplicationController"

    # Maximum number of times that a verification can be attempted.
    mattr_accessor :maximum_attempts
    @@maximum_attempts = 3

    # How long a verification code is valid for.
    mattr_accessor :expires_in
    @@expires_in = 5.minutes

    # The number of digits in the verification code.
    mattr_accessor :code_length
    @@code_length = 6

    # The chartset used to generate the verification code.
    mattr_accessor :code_charset
    @@code_charset = [*'0'..'9'].freeze

    # The parent mailer all Composable::Pwdless mailer inherit from.
    # Defaults to ActionMailer::Base. This should be set early
    # in the initialization process and should be set to a string.
    mattr_accessor :parent_mailer
    @@parent_mailer = "ActionMailer::Base"

    # Address which sends Composable::Pwdless e-mails.
    mattr_accessor :mailer_sender
    @@mailer_sender = nil

    # The path to the templates used by Composable::Pwdless mailer.
    mattr_accessor :mailer_template_path
    @@mailer_template_path = "composable/pwdless/mailer"

    # Default way to set up Composable::Pwdless.
    def self.setup
      yield self
    end

    def self.t(key, scope:, **options)
      options[:scope]   = [:composable_pwdless, scope]
      options[:default] = :"default_#{key}"

      I18n.t(key, **options)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
composable-pwdless-0.0.12 lib/composable/pwdless.rb
composable-pwdless-0.0.11 lib/composable/pwdless.rb
composable-pwdless-0.0.10 lib/composable/pwdless.rb