Module: Devise::Models::SmsVerifiable

Extended by:
ActiveSupport::Concern
Defined in:
lib/devise_sms_verifiable/model.rb

Constant Summary collapse

@@sms_secret =
nil

Instance Method Summary collapse

Instance Method Details

#sms_confirm!Object



20
21
22
23
24
25
# File 'lib/devise_sms_verifiable/model.rb', line 20

def sms_confirm!
  token = generate_token!
  public_send(:update, Hash[Devise::sms_answer_field, token,
:sms_token_sent_at, DateTime.now])
  token
end

#sms_confirmed?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/devise_sms_verifiable/model.rb', line 8

def sms_confirmed?
  public_send("#{Devise::phone_confirmation_field}?")
end

#sms_unconfirm!Object



12
13
14
15
16
17
18
# File 'lib/devise_sms_verifiable/model.rb', line 12

def sms_unconfirm!
	unconfirm_hash = Hash[Devise::sms_answer_field, nil,
          Devise::phone_confirmation_field, false,
   Devise::sms_token_sent_at, nil,
   Devise::sms_token_confirmed_at, nil]
  public_send(:update, unconfirm_hash)
end

#valid_token?(incoming_token) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/devise_sms_verifiable/model.rb', line 27

def valid_token?(incoming_token)
  @@sms_secret == incoming_token.to_s
end