-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Mongoid support #1198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Check #15, we might put a bounty on this issue |
It is old issue. Now situation is more complicated then it was in 2014. I have encounted with many other issues including this. The gem is hardcoded on ActiveRecord. And when the concern |
class LockableUser
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Locker
# many fields here
## Lockable
field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
field :unlock_token, type: String # Only if unlock strategy is :email or :both
field :locked_at, type: Time
# Include default devise modules.
devise :database_authenticatable, :registerable, :lockable
include DeviseTokenAuth::Concerns::User
include Mongoid::Locker
end When Mongoid::Locker is included there is warn in console WARN -- : Overwriting existing field locked_at in class LockableUser. I have already pulled patch into Update |
@MaicolBen def find_resource(field, value)
# fix for mysql default case insensitivity
q = "#{field.to_s} = ? AND provider='#{provider.to_s}'"
if ActiveRecord::Base.connection.adapter_name.downcase.starts_with? 'mysql'
q = 'BINARY ' + q
end
@resource = resource_class.where(q, value).first
end by def find_resource(field, value)
@resource = resource_class.where({"#{field}": value, provider: provider}).first
end With my implementation all tests passed except with mysql. Update The gem is tuned to work with NameError: NameError: uninitialized constant DeviseTokenAuth::Concerns::ResourceFinder::ActiveRecord |
@dks17 I don't know the reason of the |
Does anyone else need |
@MaicolBen I have almost finished. Should I add generator for I should write description about changes. How should do it better?
|
Why |
Upcoming changes may break initialization order of the gem. I just want users be informed about it. We discuss it when I pull changes. Hope for your help. |
@MaicolBen need your help. devise_token_auth/app/controllers/devise_token_auth/registrations_controller.rb Lines 33 to 68 in 2413d00
This piece of code is not covered with tests. devise_token_auth/test/controllers/devise_token_auth/registrations_controller_test.rb Lines 377 to 402 in 2413d00
Value of {"email"=>["has already been taken"],
"full_messages"=>["Email has already been taken"]}
I need to avoid Update |
@dks17 it makes sense, |
@dks17 is there any tasks missing for completing this support? |
@MaicolBen It's completed. Thanks. |
I got bounty for this. Thanks to the community. |
Hello! So is devise_token_auth compatible with mongoid now? I am still only able to get it to run at all with the BunHouth/devise_token_auth.git', branch: 'mongoid' version but it is throwing the Unpermitted parameters: :format, :session errors. |
@luzioluna hello. Please, see How do I use the gem with Mongoid? #1263 |
Hello.
I would like bring Mongoid gem support for the gem. Now the gem is not working with Mongoid as fact.
General plan is:
Overwriting existing field locked_at
warn (see comment). Fixed in #55 PR formongoid-locker
gem.References:
The text was updated successfully, but these errors were encountered: