shenoudab / devise_couch Goto Github PK
View Code? Open in Web Editor NEWCouchDB integration for Devise framework
Home Page: mobithought.com
License: MIT License
CouchDB integration for Devise framework
Home Page: mobithought.com
License: MIT License
Dears,
kindly, after the user signin successfully he is redirecting back to the sign in page.
seems that the logged in user not saved in the session as logged in user.
and i got that Message "Could not sign in user" from the failure_app.rb
please, check and review
Thanks for the latest update it helped a lot.
I've come across another issue, this time with the forgotten password functionality.
I believe that it has something to do with the latest change to the orm_adapter. But I am still getting my head around how things are tied together.
/Users/baphled/.rvm/gems/ruby-1.9.2-head@cvme/bundler/gems/orm_adapter-dcf9cd38b4fc/lib/orm_adapter/adapters/couchrest_model.rb:43:in `find_first'
devise (1.2.rc) lib/devise/models/authenticatable.rb:120:in `find_or_initialize_with_errors'
devise (1.2.rc) lib/devise/models/recoverable.rb:60:in `send_reset_password_instructions'
devise (1.2.rc) app/controllers/devise/passwords_controller.rb:13:in `create'
Any help would be much appreciated.
Building an app from scratch. After running
rails generate devise:install
rails generate couchrest_model:devise User
Running rake routes throws:
undefined local variable or method `authentication_keys' for User:Class
Base User model of:
class User < CouchRest::Model::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
end
config/initializer/devise.rb contains (shortened):
Devise.setup do |config|
require 'devise/orm/couchrest_model'
end
config/application.rb contains (shortened):
require File.expand_path('../boot', __FILE__)
# require 'rails/all'
require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"
require "couchrest_model"
end
Devise related gems installed:
Full rake error at:
https://gist.github.com/1532865
If a user attempts to edit their profile they will get this error.
To fix this I had to do something like this, which feels like a cludge:
class Adapter
def get! identifier
User.get(identifier)
end
end
in my User class:
def self.to_adapter
Adapter.new
end
Is there a better way / something I am missing?
When running "rails generate couchrest_model:devise User" I get a "no such file to load -- devise/orm/" error.
I guess I have to change the corresponding entry in the initializer but I don't understand this part of the instructions:
"Make sure to specify either couchrest_model (ActiveModel::Validations) as the orm in the configuration file."
--> What do I have to specify in the initializer file?
I've just switched from MongoDB to CouchDB using CouchRestModel. I've been trying to fix my login for 12 hours now and so far no success. I've looked at all the closed tickets and searched the internet for answers but I haven't found anything that helps.
If I login as the first user in alphabetical order, IE "andy", it works fine. But if I login as another user, IE "phill", it does not allow me to login. I see the redirect to my dashboard, as it should, then it redirects back to login.
I have confirmed that the find_for_authentication is returning the correct user, but something after that is causing it to fail. Maybe something in authenticate_user!.
So now I'm asking for help as I can't figure it out.
Thanks.
Don't know if this is a bug or user error.
If a user checks "remember me" it saves the remember token, but then for some reason on a new session tries to supply two keys (the user id and the token) directly to couch, and does not try to access the remember_token view. This causes the following output:
You can't search with more than one condition yet =(
Extracted source (around line #10):
7: #beta
8: #logo= link_to ' '.html_safe, :root
9: #signin
10: - if user_signed_in?
11: #userActionsLoggedin.linkmenus
12: %span Welcome, #{current_user.email}
13: %span.menuLink= link_to("Profile", :action => 'show', :controller => 'users', :id => current_user.id)
Rails.root: /Users/swells/TestHub/TestHub/testcloud-1.0.0/testcloud/testcloud
Application Trace | Framework Trace | Full Trace
/Users/swells/.rvm/gems/ruby-1.9.2-p180/bundler/gems/devise_couch-4fc35f731fbf/lib/devise/orm/couchrest_model/schema.rb:20:in find' devise (1.1.5) lib/devise/models/rememberable.rb:108:in
serialize_from_cookie'
devise (1.1.5) lib/devise/strategies/rememberable.rb:19:in authenticate!' warden (1.0.3) lib/warden/strategies/base.rb:53:in
_run!'
warden (1.0.3) lib/warden/proxy.rb:303:in block in _run_strategies_for' warden (1.0.3) lib/warden/proxy.rb:298:in
each'
warden (1.0.3) lib/warden/proxy.rb:298:in _run_strategies_for' warden (1.0.3) lib/warden/proxy.rb:271:in
_perform_authentication'
warden (1.0.3) lib/warden/proxy.rb:90:in authenticate' warden (1.0.3) lib/warden/proxy.rb:100:in
authenticate?'
devise (1.1.5) lib/devise/controllers/helpers.rb:216:in user_signed_in?' actionpack (3.0.1) lib/abstract_controller/helpers.rb:55:in
user_signed_in?'
app/views/front_page/index.haml:10:in `block in _app_views_front_page_index_haml__637491628106427591_2190825140__4307954043896241644'
I set up devise and devise_couch and could successfully create a user vía devise.
But once I want to sign in or send reset password instructions the user can not be found.
A look to the CouchDB log shows that there is just a PUT request to re-create the User's database - do I have to explicitly create devise views for the Devise (in my case User) model?
Enable the rememberable, when sign_in with the rememberable token, seems the code run into a infinite loop getting the view/all from CouchDB.
below is what CouchDB log show:
1> [info] [<0.28082.1>] 127.0.0.1 - - 'GET' /devise_couch/_design/User/_view/all?conditions=%7B%3Aremember_token%3D%3E%226PgI969vCxewiTPV0jnzoTVUIN61d8IqcUjy2GycVv4BieA9o7LFvV37zTIz%22%7D&limit=1&include_docs=true 200
1> [info] [<0.28084.1>] 127.0.0.1 - - 'GET' /devise_couch/_design/User/_view/all?conditions=%7B%3Aremember_token%3D%3E%22eLH24SRRkdRbMxExFvXMnBxx7WobsiY8RRBnjdK8TxiXLswSsAxw4vlfercz%22%7D&limit=1&include_docs=true 200
1> [info] [<0.28085.1>] 127.0.0.1 - - 'GET' /devise_couch/_design/User/_view/all?conditions=%7B%3Aremember_token%3D%3E%225jwDs6ZBxUyQIS024LvrdCixzbX8E6tdTybxA89o1stx77c56n8s51H2ihYz%22%7D&limit=1&include_docs=true 200
1> [info] [<0.28086.1>] 127.0.0.1 - - 'GET' /devise_couch/_design/User/_view/all?conditions=%7B%3Aremember_token%3D%3E%222jVrGmNnIMQxA6cyVuvPSPbQigRCb1X1l43ULHLYkFyyQYNWIEbAWdCuBkIz%22%7D&limit=1&include_docs=true 200
1> [info] [<0.28087.1>] 127.0.0.1 - - 'GET' /devise_couch/_design/User/_view/all?conditions=%7B%3Aremember_token%3D%3E%22Qx8mGCKBujDwLYwhl3nAnCvdCBDgLdOExAqhyA4FcANFl7tj9ctrDA9nf9kz%22%7D&limit=1&include_docs=true 200
1> [info] [<0.28088.1>] 127.0.0.1 - - 'GET' /devise_couch/_design/User/_view/all?conditions=%7B%3Aremember_token%3D%3E%22UOnzZVKSr3fo42mevyePNw56HM1nnL8zI3V4s1Gv648vVy5XfCGKxg6mxYMz%22%7D&limit=1&include_docs=true 200
1> [info] [<0.28089.1>] 127.0.0.1 - - 'GET' /devise_couch/_design/User/_view/all?conditions=%7B%3Aremember_token%3D%3E%222BdWU3yHR4rQHlCBluyrU3g2PqjCKx054t63Iwf4GJ1DjglGIHd5p0l3ZaEz%22%7D&limit=1&include_docs=true 200
1> [info] [<0.28090.1>] 127.0.0.1 - - 'GET' /devise_couch/_design/User/_view/all?conditions=%7B%3Aremember_token%3D%3E%22mlq5SvZ2DrsCEecn5cTg4eeOJ3OmXV52oxXypPght1ACIuGBqveXsy1OneMz%22%7D&limit=1&include_docs=true 200
1> [info] [<0.28091.1>] 127.0.0.1 - - 'GET' /devise_couch/_design/User/_view/all?conditions=%7B%3Aremember_token%3D%3E%22l4SztRmykWTaVNk8uwJX3WkzLBWVqfhV5zEofMgLxkejsKrrRULWQP8dH7Az%22%7D&limit=1&include_docs=true 200
its generating this query to couchdb:
GET /users/_design/User/_view/all?conditions=%7B%3Aauthentication_token%3D%3E%22Seaf8VnDHAv2jmLGYEuSPFoxSBF0bI5sqYxMG4KnyqeOHIaLoNAwBPDZOCwz%22%7D&limit=1&include_docs=true
it should be generating this query:
GET /users/_design/User/_view/by_authentication_token?key=%22xyzfasdasd%22
Any advice? I may investigate and append a patch if I can.
Schema Incompatible with newer versions:
Problem appears here:
https://github.com/shenoudab/devise_couch/blob/master/lib/devise/orm/couchrest_model/schema.rb#L5
More info can be found here:
https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0-migration-schema-style
Hi, there are plans to make devise_couch compatible with Rails 3.2 and Devise 2?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.