devise-activegraph icon indicating copy to clipboard operation
devise-activegraph copied to clipboard

confirmation sent with sign in and sign out

Open ahmetkizilay opened this issue 9 years ago • 4 comments

I updated device-neo4j to 2.0.2 along with the latest versions of neo4j and neo4j-core in order to migrate to neo4j 3.0.1.

After the update, I started getting confirmation emails for every sign in and sign out.

Note that I had to add property :remember_token to get the program work and I can check on the rails console that my user is confirmed.

User.find('user_id).confirmed? # returns true

What do you think is causing this behavior?

Thanks in advance

devise (4.1.1)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0, < 5.1)
      responders
      warden (~> 1.2.3)
    devise-neo4j (2.0.2)
      bcrypt (>= 3.0)
      devise (>= 3.0)
      neo4j (>= 3.0.0)
      orm_adapter (~> 0.5.0)
      railties (>= 3.1)
      warden (>= 1.2.1)
neo4j (7.0.9)
      activemodel (~> 4)
      activesupport (~> 4)
      neo4j-core (>= 6.0.0)
      orm_adapter (~> 0.5.0)
    neo4j-core (6.1.4)
      activesupport
      faraday (~> 0.9.0)
      faraday_middleware (~> 0.10.0)
      faraday_middleware-multi_json
      httparty
      httpclient
      json
      multi_json
      neo4j-rake_tasks (>= 0.3.0)
      net-http-persistent

ahmetkizilay avatar May 31 '16 14:05 ahmetkizilay

reverting back to device-neo4j (2.0.0) while neo4j and neo4j-core are at the latest version, I don't seem to have this problem.

devise (3.5.2)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      responders
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    devise-neo4j (2.0.0)
      bcrypt-ruby (~> 3.0)
      devise (~> 3.0)
      neo4j (>= 3.0.0.alpha.6)
      orm_adapter (~> 0.5.0)
      railties (>= 3.1)
      warden (~> 1.2.1)

neo4j (7.0.9)
      activemodel (~> 4)
      activesupport (~> 4)
      neo4j-core (>= 6.0.0)
      orm_adapter (~> 0.5.0)
    neo4j-core (6.1.4)
      activesupport
      faraday (~> 0.9.0)
      faraday_middleware (~> 0.10.0)
      faraday_middleware-multi_json
      httparty
      httpclient
      json
      multi_json
      neo4j-rake_tasks (>= 0.3.0)
      net-http-persistent

ahmetkizilay avatar May 31 '16 16:05 ahmetkizilay

Interesting, I'm not sure! I don't see anything obvious in the changes to 2.0.1 and 2.0.2. Here they are:

https://github.com/neo4jrb/devise-neo4j/compare/v2.0.0...v2.0.1

https://github.com/neo4jrb/devise-neo4j/compare/v2.0.1...v2.0.2

Can you try 2.0.1 to help narrow it down?

cheerfulstoic avatar Jun 02 '16 09:06 cheerfulstoic

Rails 5.1.1 Neo4j 3.2.2 Ruby 2.3.1-p112

I'm having the same problem and I see nothing wrong with the source code.

claudemircasa avatar Jul 11 '17 19:07 claudemircasa

I believe I found the problem, it is in the file "devise / lib / models / confirmable.rb" For some reason version 4.0 that contained the following code snippet works perfectly:

module Confirmable
  extend ActiveSupport::Concern
    included do
      before_create :generate_confirmation_token, if: :confirmation_required?
      after_create  :send_on_create_confirmation_instructions, if: :send_confirmation_notification?
      before_update :postpone_email_change_until_confirmation_and_regenerate_confirmation_token, if: :postpone_email_change?
     after_update  :send_reconfirmation_instructions,  if: :reconfirmation_required?
  end

While version 4.3 with the following code does not work correctly:

module Confirmable
   extend ActiveSupport::Concern
    
   included do
  before_create :generate_confirmation_token, if: :confirmation_required?
  after_create :skip_reconfirmation!, if: :send_confirmation_notification?
  if respond_to?(:after_commit) # ActiveRecord
  after_commit :send_on_create_confirmation_instructions, on: :create, if: :send_confirmation_notification?
  after_commit :send_reconfirmation_instructions, on: :update, if: :reconfirmation_required?
  else # Mongoid
  after_create :send_on_create_confirmation_instructions, if: :send_confirmation_notification?
  after_update :send_reconfirmation_instructions, if: :reconfirmation_required?
  end
  before_update :postpone_email_change_until_confirmation_and_regenerate_confirmation_token, if: :postpone_email_change?
  end


claudemircasa avatar Jul 13 '17 03:07 claudemircasa