mercredi 9 octobre 2019

on sign up if email already exist then render user on specific page with where i can display some messege

i just want to send confirmation instructions to user again if email already exist.

Thats what i've implemented, it just let user to sign Up if email is unique. if email already exist it just don't do anything.

class RegistrationsController < Devise::RegistrationsController
  layout 'pages'
  def new
    build_resource
    yield resource if block_given?
    respond_with resource
  end

  def create
    build_resource(sign_up_params)
    admin = User.create(first_name: "")
    resource.authenticatable = admin
    resource.save
    yield resource if block_given?
    if resource.persisted?
      if resource.active_for_authentication?
        set_flash_message! :notice, :signed_up
        sign_up(resource_name, resource)
        respond_with resource, location: after_sign_up_path_for(resource)
      else
        set_flash_message! :notice, :"signed_up_but_#{resource.inactive_message}"
        expire_data_after_sign_in!
        respond_with resource, location: accounts_get_started_path(resource)
      end
    else
      byebug
      clean_up_passwords resource
      set_minimum_password_length
      respond_with resource
    end
  end

  def edit
    super
  end

  def update
    super
  end

  def destroy
    super
  end
end`enter code here`

Aucun commentaire:

Enregistrer un commentaire