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
67
votes
8 answers

ActionController::InvalidAuthenticityToken in RegistrationsController#create

Hi I am using Devise for my user authentication suddenly my new user registration was not working. this was error I am getting. ActionController::InvalidAuthenticityToken Rails.root: /home/example/app Application Trace | Framework Trace | Full…
user3144005
  • 839
  • 1
  • 8
  • 13
65
votes
7 answers

Rails 3 using Devise: How to allow someone to log in using their Facebook account?

I have a Rails 3 application using Devise for authentication. Now I need to allow someone to log in using their Facebook account. I think this is called Facebook Connect, but I've also heard the term Facebook Graph API, so I'm not sure which one I'm…
Andrew
  • 227,796
  • 193
  • 515
  • 708
64
votes
5 answers

Devise redirect after login fail

All the questions I've found are related to a successful login with the helper after_sign_in_path_for(resource) I have a login form in the index of the site, and when the login fails it redirects to "users/sign_in" But how can I redirect to my…
Juanjo
  • 773
  • 1
  • 6
  • 6
64
votes
4 answers

Rails Devise: get object of the currently logged in user?

I've recently installed Devise on a rails application, and I am wondering if it is possible to get an instance of the currently logged in user in either one of the other models or controllers, and if so, how do I do that?
GSto
  • 41,512
  • 37
  • 133
  • 184
63
votes
11 answers

RoR Devise: Sign in with username OR email

What's the best way to enable users to log in with their email address OR their username? I am using warden + devise for authentication. I think it probably won't be too hard to do it but i guess i need some advice here on where to put all the stuff…
Patrick Oscity
  • 53,604
  • 17
  • 144
  • 168
60
votes
4 answers

How to specify devise_parameter_sanitizer for edit action?

I've added Devise to my Rails 4 application, and successfully added username etc. to my User model. Furthermore, I'm able to store those fields using the lazy way™, i.e. class ApplicationController < ActionController::Base before_filter…
conciliator
  • 6,078
  • 6
  • 41
  • 66
57
votes
3 answers

How to manually create a new user and user session in Devise?

I have a form where I collect a lot of information in Rails. Part of this form is fields for a new user to register. Since Devise has controllers/actions specifically to create a new user, I don't know how to programmatically create a user in an…
Sean Coleman
  • 1,287
  • 2
  • 10
  • 10
57
votes
3 answers

Strong parameters with Rails and Devise

I am using the rails 4.0 branch of devise along with ruby 2.0.0p0 and Rails 4.0.0.beta1. This is the kind of question where I am checking if I'm doing it the right way, or if there are other things I should be doing. I'm sure a lot of people moving…
user1202888
  • 1,043
  • 2
  • 11
  • 19
56
votes
5 answers

Rails 7 - link_to with method :delete still performs GET request

I am trying to get this link to work, performing a DELETE request: <%= link_to "Sign Out", destroy_user_session_path, method: :delete %> However when I click on it, my browser still performs a GET request (which fails for obvious reasons): I have…
Nils
  • 1,755
  • 3
  • 13
  • 25
56
votes
3 answers

Rails & Devise: How to render login page without a layout?

I know this is probably a simple question, but I'm still trying to figure Devise out... I want to render :layout => false on my login page; how can I do this with Devise?
neezer
  • 19,720
  • 33
  • 121
  • 220
55
votes
5 answers

How to sign in a user using Devise from a Rails console?

After loading the Rails console, how should I sign in a user? Devise provides a test helper which can be used in tests and I've tried to use in console: >> include Devise::TestHelpers >> helper.sign_in(User.first) But I get: NoMethodError:…
Christian
  • 1,872
  • 1
  • 14
  • 14
54
votes
7 answers

Devise limit one session per user at a time

My app is using Rails 3.0.4 and Devise 1.1.7. I'm looking for a way to prevent users from sharing accounts as the app is a subscription based service. I've been searching for over a week, and I still don't know how to implement a solution. I'm…
John
  • 4,362
  • 5
  • 32
  • 50
53
votes
4 answers

Rails 3 - Can Active_admin use an existing user model?

Can Active Admin use my current Devise user model? It already has a column named admin, and if it's true, I'd like to bypass the Active admin login, when going to /admin. Is this possible? Current routes: #Active…
Frexuz
  • 4,732
  • 2
  • 37
  • 54
53
votes
5 answers

Rails 4 + Devise: Password Reset is always giving a "Token is invalid" error on the production server, but works fine locally.

I have a Rails 4 application set up to use Devise, and I'm running a problem with password resets. I have the mailer set up, and the password reset email sends fine. The link provided has the correct reset_password_token assigned to it, which I…
justindao
  • 2,273
  • 4
  • 18
  • 34
52
votes
6 answers

Rails Disable devise flash messages

How I can disable all Devise gem flash messages ("successfully signed in","you logged out")? Thanks.
Marat_Galiev
  • 1,251
  • 5
  • 21
  • 31