# 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