devise

Rails 4 - Devise, guest users causes filter chain halted

心已入冬 提交于 2020-01-03 08:49:25
问题 I have just started working on a Rails 4 (4.2.3) app where I use Devise for user authentication. I want users to be able to play around with the app before signing upp by creating a test project and be signed in as a guest user. When the user signs up (or in) I want to assign the test project to the new current user. I have been following this guide from Platformatec: https://github.com/plataformatec/devise/wiki/How-To:-Create-a-guest-user Creating the guest user works, but when signing up or

Rails + devise: Trying to delete user account

て烟熏妆下的殇ゞ 提交于 2020-01-03 07:38:52
问题 When I try and delete my account in my rails app I get No route matches "/users" My View: <p>We hate to see you go. <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p> My routes: user_registration POST /users(.:format) {:action=>"create", :controller=>"devise/registrations"} new_user_registration GET /users/sign_up(.:format) {:action=>"new", :controller=>"devise/registrations"} edit_user_registration GET /users/edit(.

Generating Devise Controllers - Rails Devise

我的梦境 提交于 2020-01-03 05:23:21
问题 I am trying devise for the first time.I am following the link:https://github.com/plataformatec/devise. Here,i have executed the command: rails generate devise MODEL when i have executed this,the model and view parts are created.When i checked the routes,I have noticed that there is a controller created with the name:MODEL.but i didnot find the controller in the project.My query is how can we find whether a controller is generated or not and use that controller in the project. Thanks in

How do I customize the length of the token generated in :token_authenticatable in devise - Rails 3?

て烟熏妆下的殇ゞ 提交于 2020-01-03 03:36:09
问题 My token generated seems to be about 20 characters, how do I change the length to something else ? I checked the devise.rb file and tried both: config.token_authentication_key = :access_key config.token_authenticatable.length = 40 produced this error: config/initializers/devise.rb:110:in `block in <top (required)>': undefined method `token_authenticatable' for Devise:Module (NoMethodError) and config.token_authentication_key = :access_key config.token_authentication_key.length = 40 produced

How to fix broken devise routing under journey 1.0.4

二次信任 提交于 2020-01-03 00:45:11
问题 I began troubleshooting my "sudden" broken routes problem in this SO question: Devise /users/sign_in redirecting to wrong controller and with help I was able to isolate the issue to the upgrade from journey 1.0.3 to 1.0.4 that occurred when I updated to rails 3.2.7. As you know, we need to be at rails 3.2.8, to apply important security fixes, but this means I must use journey 1.0.4, which breaks my devise routes. For instance, my custom new_user_session route is welcome#welcome, but it is

UserMailer with Devise

拈花ヽ惹草 提交于 2020-01-02 23:09:34
问题 am using my custom mailer UserMailer to send emails. It works perfect in development, but in production i get error 500, that is when am trying to retrieve my password on forgetting. here is what is in the production logs in the production mode Processing by Devise::PasswordsController#create as HTML Parameters: {"utf8"=>"✓","authenticity_token"=>"xxxxxxxxxxxxxxx", "user"=>{"email"=>"sam@gmail.com"}, "commit"=>"Send me r$ Completed 500 Internal Server Error in 2ms NameError (uninitialized

using devise WITHOUT the gem, can I simply copy the files?

杀马特。学长 韩版系。学妹 提交于 2020-01-02 18:17:22
问题 Could I simply copy the devise app and lib (and gem?) folders into my respective project folders and have them work just as if I was using the gem? I'd like to do this so that I can really see all the code, possibly do some customization, and also avoid some "cannot find" errors in my IDE. Is this a bad idea? If this is something that would work would I simply need to remove the gem and copy over the necessary files or would I need to "undo" things that the gem has done. Could this create

Override current_user in ApplicationController throws undefined method error

点点圈 提交于 2020-01-02 09:45:51
问题 Based on stackoverflow question for overriding current_user of devise, I wrote something like this: class ApplicationController < ActionController::Base alias_method :devise_current_user, :current_user def current_user if !devise_current_user.nil? return # my logic end return nil end end Two questions: 1. It throws an undefined method error where I define alias_method .... 2. In the devise_for method, will my overriden current_user will be passed or the devise's current_user? 来源: https:/

Override current_user in ApplicationController throws undefined method error

。_饼干妹妹 提交于 2020-01-02 09:45:29
问题 Based on stackoverflow question for overriding current_user of devise, I wrote something like this: class ApplicationController < ActionController::Base alias_method :devise_current_user, :current_user def current_user if !devise_current_user.nil? return # my logic end return nil end end Two questions: 1. It throws an undefined method error where I define alias_method .... 2. In the devise_for method, will my overriden current_user will be passed or the devise's current_user? 来源: https:/

Devise hidden fields

a 夏天 提交于 2020-01-02 08:34:09
问题 I created a devise model migration is: t.string :provider, null: false, default: "email" t.string :uid, null: false, default: "" ## Database authenticatable t.string :encrypted_password, null: false, default: "" ## Recoverable t.string :reset_password_token t.datetime :reset_password_sent_at # etc... When I do rails c and type User there I get a huge list of its columns User(id: integer, provider: string, uid: string, encrypted_password: string, reset_password_token: string, reset_password