Sha256: e526e5d51ab17a238ce8aa74b62fd8feebf1b511d4fbbedfc194984f4c2a772d

Contents?: true

Size: 1.49 KB

Versions: 9

Compression:

Stored size: 1.49 KB

Contents

class Devise::PhoneVerificationsController < DeviseController

  before_action :authenticate_user!

  # 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(phone_number_params[:phone_number])
    
    render nothing: true
    # respond_to do |format|
    #   msg = { :status => "ok", :message => "SMS sent!" }
    #   format.json  { render :json => msg } # don't do msg.to_json
    #   format.html { render nothing: true }
    # end
  end
  
  # GET or POST /resource/phone_verification/verify_code
  def verify_code
    verify_success = current_user.verify_phone_number_with_code_entered(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
    #   format.html { render nothing: true }
    # end
  end
  
  protected
  
    def build_resource(hash = nil)
      self.resource = resource_class.new
    end


  private
    def phone_number_params
      params.permit(:phone_number)
    end

    def code_entered_params
      params.permit(:code_entered)
    end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
devise_phone-0.1.26 app/controllers/devise/phone_verifications_controller.rb
devise_phone-0.1.25 app/controllers/devise/phone_verifications_controller.rb
devise_phone-0.1.24 app/controllers/devise/phone_verifications_controller.rb
devise_phone-0.1.23 app/controllers/devise/phone_verifications_controller.rb
devise_phone-0.1.22 app/controllers/devise/phone_verifications_controller.rb
devise_phone-0.1.21 app/controllers/devise/phone_verifications_controller.rb
devise_phone-0.1.2 app/controllers/devise/phone_verifications_controller.rb
devise_phone-0.1.1 app/controllers/devise/phone_verifications_controller.rb
devise_phone-0.1.0 app/controllers/devise/phone_verifications_controller.rb