Sha256: f8ef46ec56ec3e39a5fed49b1491e48414074524e3aead62a32a0749e441ae0e

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

class Devise::PhoneVerificationsController < DeviseController

  # GET /resource/phone_verification/new
  # def new
  #   build_resource({})
  #   render :new
  # end

  # POST /resource/phone_verification
  # def create
  # end
  
  # GET /resource/phone_verification/send_code
  def send_code
    current_user.generate_verification_code_and_send_sms
    # render nothing: true
    respond_to do |format|
      msg = { :status => "ok", :message => "SMS sent!" }
      format.json  { render :json => msg } # don't do msg.to_json
    end
  end
  
  # GET or POST /resource/phone_verification/verify_code
  def verify_code
    verify_success = current_user.verify_phone_number_with_code_entered(params[:code_entered])
    # render nothing: true
    respond_to do |format|
      if verify_success
        message_response = "verification successful"
      else
        message_response = "verification fail"
      end
      msg = { :status => "ok", :message => message_response }
      format.json  { render :json => msg } # don't do msg.to_json
    end
  end
  
  protected
  
    def build_resource(hash = nil)
      self.resource = resource_class.new
    end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
devise_phone-0.0.17 app/controllers/devise/phone_verifications_controller.rb
devise_phone-0.0.1667 app/controllers/devise/phone_verifications_controller.rb
devise_phone-0.0.1666 app/controllers/devise/phone_verifications_controller.rb
devise_phone-0.0.1665 app/controllers/devise/phone_verifications_controller.rb
devise_phone-0.0.1664 app/controllers/devise/phone_verifications_controller.rb
devise_phone-0.0.1663 app/controllers/devise/phone_verifications_controller.rb