Module: Devise

Defined in:
lib/devise_sms_confirmable.rb,
lib/devise_sms_confirmable/models/sms_confirmable.rb,
lib/devise_sms_confirmable/models/sms_validatable.rb,
lib/devise_sms_confirmable/models/sms_authenticatable.rb

Defined Under Namespace

Modules: Models Classes: SmsConfirmationsController, Texter

Constant Summary collapse

@@sms_confirm_within =
nil
@@sms_confirmation_keys =
[:phone]
@@send_phone_changed_notification =
false
@@parent_texter =
"Textris::Base"
@@sms_sender =
nil
@@e164_phone_regexp =
/\A\+?[1-9]\d{1,14}\z/
@@sms_reconfirmable =
true
@@allow_sms_unconfirmed_access_for =
0.days
@@sms_reset_password_within =
10.minutes

Class Method Summary collapse

Class Method Details

.friendly_sms_code(length = 6) ⇒ Object

Generate a friendly number randomly to be used as SMS code. By default, length is 6 characters.

Raises:

  • (ArgumentError)


55
56
57
58
# File 'lib/devise_sms_confirmable.rb', line 55

def self.friendly_sms_code(length = 6)
  raise ArgumentError, "sms code must be in 4 ~ 8" unless length.between?(4, 8)
  (0..9).to_a.sample(length).join
end

.texterObject

Get the sms sender class from the texter reference object.



42
43
44
# File 'lib/devise_sms_confirmable.rb', line 42

def self.texter
  @@texter_ref.get
end

.texter=(class_name) ⇒ Object

Set the smser reference object to access the smser.



47
48
49
# File 'lib/devise_sms_confirmable.rb', line 47

def self.texter=(class_name)
  @@texter_ref = ref(class_name)
end