Giter Club home page Giter Club logo

devise's Issues

Additional attributes for User model

It would be nice to have something like "last_login_at" and "last_login_from" (client IP) in User model or a hook or a filter in the session controller that allows to populate them prperly.

Thanks in advance

password requeriment

The password is required in all updates. But if i want change only the email?

maybe a :allow_blank in validate_presence_of :password solve.

Devise routes with subdomain_fu

I am setting up a site where I want all my users to sign in on their appropriate subdomain. I would like to use the following in my routes:

map.with_options :conditions => { :subdomain => /.+/ } do |workplace|
  workplace.devise_for :employees
end

When I do use that I get an error that it doesn't know about the conditions key. anyway I can do something similar?

Proposal: Flexible Views

Perhaps it would be helpful to have flexible views for different Devise resources (users, admins, etc.). For example, an admin login form might need to be very different from a user sign-up page, yet both views are currently called from SessionsController#new which renders controllers/views/sessions/new.html.erb. It would be really useful to be able to render controllers/views/sessions/admins/new.html.erb, or controllers/views/sessions/users/new.html.erb, or some other specified view.

For now, we can include conditional logic in controllers/views/sessions/new.html.erb (e.g., if we're dealing with users, render form x, else render form y for admins), but this makes for a brittle view. Is there currently a cleaner way to do this? Or might this kind of view customization be a useful feature to add?

Booting app with Devise and Bundler failed

I'm getting this error with Devise and Bundler. If I run app without Devise, it is okay.

root@ROOT:/c/dev/MUNI/Bakalarka/portfonica$ ruby script/server
=> Booting Mongrel
=> Rails 2.3.4 application starting on http://0.0.0.0:3000
c:/dev/MUNI/Bakalarka/portfonica/gems/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:440:in `rescue in load_missing_constant': uninitialized constant Controllers::Filters (NameError)
        from c:/dev/MUNI/Bakalarka/portfonica/gems/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:436:in `load_missing_constant'
        from c:/dev/MUNI/Bakalarka/portfonica/gems/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:80:in `const_missing_with_dependencies'
        from c:/dev/MUNI/Bakalarka/portfonica/gems/gems/devise-0.4.3/lib/devise/rails/routes.rb:10:in `load_routes_with_devise!'
        from c:/dev/MUNI/Bakalarka/portfonica/gems/gems/actionpack-2.3.4/lib/action_controller/routing/route_set.rb:266:in `load!'
        from c:/dev/MUNI/Bakalarka/portfonica/gems/gems/rails-2.3.4/lib/initializer.rb:537:in `initialize_routing'
        from c:/dev/MUNI/Bakalarka/portfonica/gems/gems/rails-2.3.4/lib/initializer.rb:188:in `process'
        from c:/dev/MUNI/Bakalarka/portfonica/gems/gems/rails-2.3.4/lib/initializer.rb:113:in `run'
        from c:/dev/MUNI/Bakalarka/portfonica/config/environment.rb:5:in `'
        from c:/dev/MUNI/Bakalarka/portfonica/gems/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
        from c:/dev/MUNI/Bakalarka/portfonica/gems/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `block in require'
        from c:/dev/MUNI/Bakalarka/portfonica/gems/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
        from c:/dev/MUNI/Bakalarka/portfonica/gems/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
        from c:/dev/MUNI/Bakalarka/portfonica/gems/gems/rails-2.3.4/lib/commands/server.rb:84:in `'
        from script/server:3:in `require'
        from script/server:3:in `'
root@ROOT:/c/dev/MUNI/Bakalarka/portfonica$

My settings is here:
http://github.com/wycats/bundler/issues#issue/88

I declared nothing Devise anywhere. No configuration in environment.rb or used an initializer. I just specified it in my Gemfile.

Sign up email confirmation error

I'm getting the following when trying to create a new user:

NoMethodError (undefined method `find_template' for []:Array):
devise (0.3.0) lib/devise/models/confirmable.rb:59:in `send_confirmation_instructions'

uninitialized constant Devise::Encryptors

Wanted to give devise a try instead of authlogic.

I set everything up as desribed in the README, but when trying to start the server or even trying "rake db:migrate" I get the following error:

"uninitialized constant Devise::Encryptors"

Details:

...
rake aborted!
uninitialized constant Devise::Encryptors
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:440:in load_missing_constant' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:80:inconst_missing'
/home/cjk/work/hot/hotrails/vendor/gems/devise-0.5.5/lib/devise.rb:57
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
...

I use devise 0.5.5 and latest version of warden.

Thanks!

bug in serialize_from_session

the exception ActiveRecord::RecordNotFound is shown when the register no more exist. and should redirect to login page.

FIX:
The following changes since commit 05678e7:
José Valim (1):
Added support to config.default_url_options.

are available in the git repository at:

[email protected]:ramon/devise.git master

Ramon Soares (2):
fix record not found failure in recovery session
failure_app logout with scope now

lib/devise/failure.rb | 2 ++
lib/devise/warden.rb | 6 +++++-
2 files changed, 7 insertions(+), 1 deletions(-)

Breaks on Ruby 1.8.6 / Heroku.com

Hello,
when trying do run an application using devise on heroku (www.heroku.com) I seem to be having some problems, namely with the controller "confirmations", action "show" (when I go to confirm a password in an email).

NoMethodError (undefined method `one?' for #«Array:0x2ac12c27d860»):
  devise (0.5.4) lib/devise/controllers/filters.rb:129:in `sign_in_and_redirect'
  devise (0.5.4) app/controllers/confirmations_controller.rb:27:in `show'
  warden (0.6.3) lib/warden/manager.rb:84:in `call'
  warden (0.6.3) lib/warden/manager.rb:83:in `catch'
  warden (0.6.3) lib/warden/manager.rb:83:in `call'
  /home/heroku_rack/lib/static_assets.rb:9:in `call'
  /home/heroku_rack/lib/last_access.rb:25:in `call'
  /home/heroku_rack/lib/date_header.rb:14:in `call'

As I gather, the problem seems to be that heroku is using ruby version 1.8.6
http://docs.heroku.com/technologies

which apparently doesn't support the Enumerable::one? method.

Maybe if this method call could be replaced with something else, not just for heroku, but backwards compatibility with 1.8.6 in general, it's still a widely used ruby version.

Thanks,
Tomislav Car

missing datamapper methods

def confirmed_at?
confirmed_at
end

def confirmation_sent_at?
confirmation_sent_at
end

def remember_token?
remember_token
end

it seems that activerecord defines attribute_method with ? and datamapper doesnt

issues with namespace

Hi plataformatec,

Devise has support for namespaces?

My application have authentication only into admin scope and I want to use Devise for that.

I tried this:

ActionController::Routing::Routes.draw do |map|
  map.namespace 'admin' do |admin|
    admin.devise_for :users
  end
end

And I get into rake routes:

(in /home/sobrinho/projetos/xxx)
    new_user_session GET  /admin/users/sign_in  {:action=>"new", :controller=>"admin/sessions"}
        user_session POST /admin/users/sign_in  {:action=>"create", :controller=>"admin/sessions"}
destroy_user_session GET  /admin/users/sign_out {:action=>"destroy", :controller=>"admin/sessions"}

Well, admin/sessions doesn't exist. Then i renamed route to use sessions controller:

ActionController::Routing::Routes.draw do |map|
  map.namespace 'admin' do |admin|
    admin.devise_for :users, :controller => 'sessions'
  end
end

But i get

Unknown action
error when i access login page.

Haven't support or i'm doing something wrong?

Need mechanism to create instance variables in SessionsController.

For example, an app that has two forms 'Sign in' and 'Sign up' in the sessions/new view. This view requires the @user instance variable. Currently, Devise has no mechanism to create this. It appears the best we to handle this is to create a generator to add a SessionsController to the app in the same way that we generate the sessions views. Other ideas?

wishlist: pretty url for login/logout

I want it to simply be '/login', and '/logout'

I managed to do so by adding these to the routes file

map.login 'login', :controller => :sessions, :action => :new, :conditions => { :method => :get }
map.login 'login', :controller => :sessions, :action => :create, :conditions => { :method => :post }
map.logout 'logout', :controller => :sessions, :action => :destroy

But I still have a problem with the before_filter :authenticate_user! where it still redirects the user to 'http://localhost:3000/users/sign_in?unauthenticated=true'.

I would really appreciate it if you can tell me how to override the login url. Thanks.

Authenticable?

Isn't the word "authenticatable" rather than "authenticable". I'm not sure authenticable is actually a word. Maybe that is how everyone thinks it is spelled so it doesn't matter.

Best Regards,
David Baldwin

Setting email sender

Perhaps these are all valid, but this seems to lack clarity as to how the email sender should be set. Here are three different stated ways that the sender can be set...

On command line after "script/generate devise Model"...

Setup default sender for mails.In config/environment.rb:
Notifier.sender = "[email protected]"

README - development environment

DeviseMailer.sender = "[email protected]"

initializers/devise.rb after "script/generate devise_install"

config.mail_sender = "[email protected]"

Best Regards,
David Baldwin

uninitialized constant Devise::Strategies (NameError)

from .... /devise-0.1.1/lib/devise/warden.rb:60

Happening with Rails 2.3.4 Devise 0.1.1
I am using the gem bundler stuff but it seems like it's loaded what I'd expect, there's just no Devise::Strategies

Am I missing something to get that module loaded? Am I supposed to manually require those files from the devise lib?

email field not created in the database

ruby script/generate devise Model
rake db:migrate

email field not created in the database;
rake aborted!
Mysql::Error: Key column 'email' doesn't exist in table: CREATE UNIQUE INDEX `index_

Store and redirect to a requested url *and* present a custom flash

Need mechanism to store and redirect to a requested url and present a custom flash as describe in the scenario below. The first can be done with #authenticate_user! and the second with before_filter :set_flash_and_redirect_to_sign_in, but both are not currently possible.

Given I am a guest
When I follow "Create Post"
I should be on the new user session page
And I should see a message "Please sign in or sign up to create a post"
When I sign in
I should be on the new post page

confirmable with confirm_within = 0.days allows the user to signup anyway.

I had to put this on my User model cause confirm_within = 0.days does not seem to work properly

def confirmation_period_valid?
false
end

By the way, the intuitive use of confirmable imho is make it 0.days. Normally sites do not enable you to login until you click on the confirmation link. The documentation says the default confirm_within is nil but it does not seem to be working properly. One more thing, I would change the name of the setting:

config.signup_allowed_without_confirming_period = 2.days

or something, you get the idea.

undefined method `find_template' for []:Array

Hi!

I have got following error on user.save:
undefined method `find_template' for []:Array

Rails 2.3.4.
Also I did script/generate devise_views before saving users.

Backtrace:
/usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.4/lib/action_mailer/base.rb:582:in candidate_for_layout?' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.4/lib/action_controller/layout.rb:240:inpick_layout'
/usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.4/lib/action_mailer/base.rb:566:in render' /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.4/lib/action_mailer/base.rb:553:inrender_message'
/usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.4/lib/action_mailer/base.rb:493:in create!' /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.4/lib/action_mailer/base.rb:452:ininitialize'
/usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.4/lib/action_mailer/base.rb:395:in new' /usr/lib/ruby/gems/1.8/gems/actionmailer-2.3.4/lib/action_mailer/base.rb:395:inmethod_missing'
/usr/lib/ruby/gems/1.8/gems/devise-0.5.5/lib/devise/models/confirmable.rb:59:in send_confirmation_instructions' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:insend'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:178:in evaluate_method' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:166:incall'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:93:in run' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:92:ineach'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:92:in send' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:92:inrun'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/callbacks.rb:276:in run_callbacks' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/callbacks.rb:344:incallback'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/callbacks.rb:267:in create' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2867:increate_or_update_without_callbacks'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/callbacks.rb:250:in create_or_update' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/base.rb:2538:insave_without_validation'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/validations.rb:1078:in save_without_dirty' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/dirty.rb:79:insave_without_transactions'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:229:in send' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:229:inwith_transaction_returning_status'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in transaction' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:182:intransaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:228:in with_transaction_returning_status' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:196:insave'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:208:in rollback_active_record_state!' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.4/lib/active_record/transactions.rb:196:insave'

MongoMapper method missing for devise

I've attempted to use devise along side jnunemaker's mongo_mapper and I continue to run into an issue where my model:
class User
include MongoMapper::Document
devise :all
end

results in:
method_missing :NoMethodError: undefined method 'devise_modules' for User:Class

Any hints on how to get it to properly extend Devise::Models ? My ruby meta-fu is weak!

Additional fields in User model

When I add additional fields in my User model they get completely ignored. I tried creating a new project and using an Account model but the same thing happened. Am I missing something obvious?

Wishlist - Pretty URL for verification path and reset password path

It would be nice to have pretty URL for recoverable and confirmable strategies routes.
As is:
"/users/verification?confirmation_token=MyHash"

Nice to have:
"/users/verification/MyHash"

so that confirmation_token is passed in route as param:
"/users/verification/:confirmation_token {:controller=>"users", :action=>"index"}"

Something like:
"map.connect 'users/verification/:confirmation_token', :controller => 'users'"

I don't know how to obtain this, or even if it is possible.
What do you think?

script/generate devise_install not working

Hi everyone,

I installed the latest devise gem (0.4.1) but script/generate devise_install results in the following error:

$ script/generate devise_install
Couldn't find 'devise_install' generator

I wonder whether this is only a problem on my side, or if the generator is missing from the gem ...?

Best regards
Martin Eisenhardt

Version 0.6.2 not working on Ruby 1.8.6

Hello,
the latest version I pulled doesn't seem to work properly with Ruby 1.8.6. The problem appears when calling
@user.confirm_within

It works on Devise 0.5.5 and Ruby 1.8.6.

It also works on Devise 0.6.2 and Ruby 1.8.7

But it doesn't work on Devise 0.6.2 and Ruby 1.8.6. Reports that it can't with the method "confirm_within".

build_resouce method doesnt work with datamapper

for sign in page.

DataMapper.new blow up if you pass in a nil

suggesting fix

  # Build a devise resource without setting password and password confirmation fields.
  def build_resource
    self.resource ||= begin
      attributes = params[resource_name].try(:except, :password, :password_confirmation)
      resource_class.new(attributes || {})
    end
  end

undefined method `mappings' for Devise:Module (NoMethodError)

script/generate formtastic
/Library/Ruby/Gems/1.8/gems/devise-0.1.0/lib/devise/controllers/filters.rb:72: undefined method mappings' for Devise:Module (NoMethodError) from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:380:inload_without_new_constant_marking'

Proposal: Namespace Controllers

Perhaps this would allow subclassing Devise controllers in order to override their default methods. For example, suppose we wanted the SessionsController#destroy action to redirect to the admin_root_path rather than the root_path. We would then want to create the app/controllers/sessions_controller.rb file like so:

class SessionsController < Devise::SessionsController
  def destroy
    set_flash_message :success, :signed_out if signed_in?(resource_name)
    sign_out(resource_name)
    redirect_to admin_root_path
  end
end

Or is there some other way to override the default SessionsController behavior?

Improve update email process

The current update email process needs some love. I suggest:

Given I am signed in
When I update my email address
Then a confirmation email should be sent
And I should be on my account page
And I should see a message "A confirmation email has been sent to your new email address. Your old email address, {resource.email}, is still active until you confirm the new one."
When I follow the link in the confirmation email
Then I should be on my account page

And I should see a message "Your email address has been confirmed."

This is a bit more complicated, but I think it's best practice. The User model will need a :pending_email attribute. You could go a bit further and add something like this in a Devise-generated resource show view:

-if resource.pending_email
You have requested to change your email address to {resource.pending_email}. An email has been sent there to make sure it is a valid address.
= link_to 'Resend confirmation email', ...
= link_to 'Cancel request', ...

Having all this by right out the box would be beautiful!

authentic_user! locks up app

Everything was working great in a previous version of Devise but when I upgraded to 0.2.0 authentic_user! now locks up the rails app if the user isn't logged in. Basically what appears to happen is the browser sees the redirect to /users/sign_in?unauthenticated=true and then the app stops responding until it's restarted. When I restart the app I can hit that url directly and login just fine. I suspect the problem is with Warden because Rails isn't outputting anything. Any thoughts? Anybody else seen this issue?

Devise is not compabile with Rails 3 callbacks

Hi,
I'm using Devise with CouchRest and I would like use Confirmable mixin in my ExtendedDocument. Unfortunately, it fails because CouchRest uses callbacks from Rails 3 and Devise just is compatible with Rails 2 callbacks :(

bug in encryptor length lookup.

apply_schema :encrypted_password, String, :null => null, :limit => Devise::ENCRYPTORS_LENGTH[encryptor]

Devise::ENCRYPTORS_LENGTH is a hash of symbol, but 'encryptor' returns a class so the look up always returns a nil.

0.4.0 breaks script/generate...

If you use the devise.rb initializer and enable the commented out options, script/generate fails. Here's a stack trace:

script/generate
/Users/rich/dev/42rooms/config/initializers/devise.rb:6: undefined method pepper=' for Devise:Module (NoMethodError) from /Users/rich/dev/42rooms/vendor/gems/devise-0.4.0/lib/devise.rb:18:insetup'
from /Users/rich/dev/42rooms/config/initializers/devise.rb:3
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:145:in load_without_new_constant_marking' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:145:inload'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in new_constants_in' from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:145:inload'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:622:in load_application_initializers' from /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:621:ineach'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:621:in load_application_initializers' from /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:176:inprocess'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in send' from /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:inrun'
from /Users/rich/dev/42rooms/config/environment.rb:4
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:inrequire'
from /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/commands/generate.rb:1
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:inrequire'
from script/generate:3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.