Adding devise confirmable module within web api or any other technique for same functionality?

165 views Asked by At

I would like to add devise confirmable functionality to web service, I would like to know steps to integrate it, code in registration_controller.rb :-

class Api::RegistrationsController < Devise::RegistrationsController
  skip_before_filter :verify_authenticity_token
  respond_to :json
  def create
    user = User.new(user_params)
    if user.save
      render(
        json: Jbuilder.encode do |j|
          j.sucess true
          j.count 1
          j.type "userObject"
          j.message "signed up successfully."
          j.data user, :email, :role, :authentication_token, :activation_state
        end,
        status: 201
      )
      return
    else
      warden.custom_failure!
      render :json=> user.errors, :status=>422
    end
  end

  protected

  def user_params
    params.require(:user).permit!
    #params[:user].permit(:email, :password, :password_confirmation)
  end
end
0

There are 0 answers