Sha256: 10b2ae305b0960271744ae2d37f0fb7fc35a818b2c853c283e6c645b3e096901
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
module DeviseTokenAuth class RegistrationsController < Devise::RegistrationsController include Devise::Controllers::Helpers prepend_before_filter :require_no_authentication, :only => [ :create ] before_action :configure_devise_token_auth_permitted_parameters respond_to :json def create @resource = resource_class.new(resource_params) @resource.uid = resource_params[:email] @resource.provider = "email" begin if @resource.save render json: { status: 'success', data: @resource.as_json } else clean_up_passwords @resource render json: { status: 'error', data: @resource, errors: @resource.errors }, status: 403 end rescue ActiveRecord::RecordNotUnique clean_up_passwords @resource render json: { status: 'error', data: @resource, errors: ["An account already exists for #{@resource.email}"] }, status: 403 end end def resource_params params.permit(devise_parameter_sanitizer.for(:sign_up)) end def configure_devise_token_auth_permitted_parameters devise_parameter_sanitizer.for(:sign_up) << :confirm_success_url end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devise_token_auth-0.1.27.beta2 | app/controllers/devise_token_auth/registrations_controller.rb |