Questions tagged [devise]

Devise is an authentication gem for Ruby-on-Rails. It supersedes previous solutions such as Restful Authentication or Authlogic.

Devise is an authentication gem for Ruby-on-Rails. It supersedes previous solutions such as Restful Authentication or Authlogic.

Devise is built as a Rails engine and is a full-featured drop-in solution that comes with a complete set of controllers and views to support features such as user registration, user password recovery, user authentication, user email verification and many more.

Devise works with Rails 3 and Rails 4, and also supports a branch compatible with Rails 2.3.

Devise was originally developed by José Valim and Carlos Antônio da Silva and released at Rails Summit Latin America 2009.

Resources

15025 questions
87
votes
9 answers

Setting Devise Login to be root page

I am using the following code for my routes: devise_for :user, :as => '', :path_names => { :sign_in => "", :sign_out => "logout", :sign_up => "register" } But when I'm logged out and I goto /logout I get the following…
Logan Bailey
  • 7,039
  • 7
  • 36
  • 44
86
votes
8 answers

different layout for sign_in action in devise

I'm trying to use a different/custom layout named "devise" for the sign_in action. I found this page in the devise wiki, and the second example even says you can do it per-action (in this case, sign_in action), but it shows no example of doing that.…
Jorge Israel Peña
  • 36,800
  • 16
  • 93
  • 123
84
votes
3 answers

where is devise implementation of "authenticate_user!" method?

Where is devise implementation of authenticate_user! method? I have been looking for it and have not found it so far.
Greg
  • 34,042
  • 79
  • 253
  • 454
83
votes
10 answers

rails - "WARNING: Can't verify CSRF token authenticity" for json devise requests

How can I retrieve the CSRF token to pass with a JSON request? I know that for security reasons Rails is checking the CSRF token on all the request types (including JSON/XML). I could put in my controller skip_before_filter…
user1027503
82
votes
8 answers

Customizing Devise views in Rails

I'm using devise for user auth, but I have nice mockups for the signup, login, etc. pages. I've already done the rails generate devise:views User command and have all of the views in the views folder, however, when I replaced the…
Vasseurth
  • 6,354
  • 12
  • 53
  • 81
81
votes
19 answers

Devise update user without password

I want to update users attributes without password in devise. The case is like, if password and password confirmation fields are not blank then I need devise error and if they are blank then other user attributes need to be updated. How could I do…
kriysna
  • 6,118
  • 7
  • 30
  • 30
81
votes
2 answers

Is devise's token_authenticatable secure?

I'm building a simple api with Rails API, and want to make sure I'm on the right track here. I'm using devise to handle logins, and decided to go with Devise's token_authenticatable option, which generates an API key that you need to send with each…
Jeff Escalante
  • 3,137
  • 1
  • 21
  • 30
78
votes
4 answers

Weird issue with devise valid_password?

For the past 2 hours, I have been trying to debug a weird issue in devise which is not letting me login. Here's the stuff I'm referring too: password => 'vinodsobale' password == 'vinodsobale' => true resource.valid_password?(password) =>…
Viren
  • 5,812
  • 6
  • 45
  • 98
77
votes
4 answers

devise and multiple "user" models

I'm using rails 3.2 and devise 2.0 and I'm quite new to Rails. Requirements I'd like to achieve the following: have 2 or more "user" models, eg. Member, Customer, Admin all models share some required fields (eg. email and password) each model may…
ddidier
  • 1,298
  • 1
  • 12
  • 15
76
votes
4 answers

undefined method `devise_for' in rails

After I install devise and create a user model. I rake db:migrate and then I rake routes. I then get a error with "undefined method `devise_for' for #". What could be causing this error?
Yeddie
  • 863
  • 2
  • 7
  • 7
72
votes
3 answers

Devise - create user account with confirmed without sending out an email?

I integrated devise with facebook. Now when I create a user account after the user has logged in with his/her facebook account, user = User.create(:email => data["email"], :password => Devise.friendly_token[0,20]) …
xjq233p_1
  • 7,810
  • 11
  • 61
  • 107
70
votes
4 answers

disabling Devise registration for production environment only

I am launching a beta site with a select group of users. I want to disable registration in the production environment only, and only for a short period of time (i.e. I don't want to nuke my registration altogether). I know I can simply hide the…
panzhuli
  • 2,890
  • 6
  • 33
  • 46
70
votes
3 answers

Is this Rails JSON authentication API (using Devise) secure?

My Rails app uses Devise for authentication. It has a sister iOS app, and users can log in to the iOS app using the same credentials that they use for the web app. So I need some kind of API for authentication. Lots of similar questions on here…
GMA
  • 5,816
  • 6
  • 51
  • 80
68
votes
6 answers

"WARNING: Can't mass-assign protected attributes"

I have used RESTful techniques to generate a model (in fact, I am using Devise gem, which does that for me), and I have added new fields called first_name and last_name to the model. Migration went fine. I added attr_accessor :first_name, :last_name…
picardo
  • 24,530
  • 33
  • 104
  • 151
67
votes
3 answers

Undefined local variable or method `unconfirmed_email' when registering users?

I just installed Devise in my app, configured the views and everything. However, when I click the sign up button I get this error: NameError in Devise::RegistrationsController#create undefined local variable or method `unconfirmed_email' for…
varatis
  • 14,494
  • 23
  • 71
  • 114