devise

Editing user details creates new user. Devise, Rails 4

我怕爱的太早我们不能终老 提交于 2020-01-24 09:33:46
问题 I have weird problem, previous created form instead of updating user details such as e-mail or name creates new user with given details. My form: this code example I took from views/devise/registrations/edit <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { "data-parsley-validate" => true, :id=>"user-edit"},remote: true, format: :json) do |f| %> <div class="form-group"> <%= f.text_field :name,:class=>"user-input form-control", :id=>"user-name" ,

How to get devise to work with accepts_nested_attributes_for in a has one relationship?

﹥>﹥吖頭↗ 提交于 2020-01-23 10:45:08
问题 I am trying to get my user form to also allow the user to fill out their company profile at the same time via form_for. For some reason it is not showing the company fields. Here is my code for the controller and layouts. class User < ActiveRecord::Base attr_accessible :company_attributes has_one :company accepts_nested_attributes_for :company end class Company < ActiveRecord::Base belongs_to :user # Validation validates :name, :presence => true end <%= f.fields_for :company do |company_form|

Setup devise with custom registration controller

橙三吉。 提交于 2020-01-23 07:06:06
问题 I'm working on a rails site using devise, where we do not want user sign ups just yet. User authentication is so we can login to access restricted parts of the site and add/edit things as we see fit. So for now, I created the following controller: class Users::RegistrationController < Devise::SessionsController def new end end And setup my routes in this fashion: devise_for :users, :controllers => { :registration => "users/registration" } However, when I run rake routes, I still see a

Rails(5.1.1) asset pipeline ,sprockets error

亡梦爱人 提交于 2020-01-23 03:59:08
问题 In my rails app I used three gems for authentication and styling, they are devise , twitter-bootstrap-rails and devise-bootstrap-views . After following all the steps in the guides, I started my rails server an error showed up saying The asset "apple-touch-icon-144x144-precomposed.png" is not present in the asset pipeline. What does it mean and how can I sort it out? 回答1: Revert to the original behaviour by adding Rails.application.config.assets.unknown_asset_fallback = true to the file

Devise Confirmation invalid on first send

我是研究僧i 提交于 2020-01-23 01:47:47
问题 I have a Rails 4 app with Devise 3.2.2 using :confirmable , and am running into an issue with it sending invalid confirmation tokens, but only the first time . After you resend the confirmation token, the link works. The relevant routes: devise_for :users, skip: [:sessions, :passwords, :confirmations, :unlocks, :registrations, :invitations] as :user do ... # joining get '/register' => 'devise/registrations#new', as: 'new_user_registration' post '/register' => 'devise/registrations#create', as

Devise. Registration and Login at the same page

不羁岁月 提交于 2020-01-22 17:59:23
问题 I'm trying to integrate Devise into my application. I need implement login form at top of the page (I've implemented this form into layout page) and I've implemented registration which contains registration form. But it shows validation errors for both form when I tried submit incorrect registration data. 回答1: Without more information, it's hard to guess what the problem is. I've found the Wiki pages to be really helpful (and increasingly so), though you may have already looked them over:

undefined method `model_name' for TrueClass:Class for DeviseConfirmations (Rails 4, devise)

余生颓废 提交于 2020-01-21 10:26:11
问题 In my Rails app, in order to save user country (using Geocoder gem) into the User table when the user signs up, and using another SO question, I have changed something in my controllers/confirmations_controller.rb but am getting a serious error I don't understand nor manage to solve: def after_sign_up_path_for(resource) if Devise.allow_insecure_sign_in_after_confirmation resource.update(user_country: request.location.country) after_sign_in_path_for(resource) else resource.update(user_country:

Ember.js session cookie based authentication with Rails and devise

孤者浪人 提交于 2020-01-21 02:14:53
问题 I'm looking to satisfy 3 goals with my Ember.js app authentication using rails, devise and a cookie based session. Redirected to #/sessions/new if they're not logged in. Always show the current user's information in the application template. If the user is logged in and they go to #/some/route directly. The current user should be loaded on load. I've watched these embercast videos: Client-side Authentication Part 1 & Client-side Authentication Part 2. They're a little out of date but helpful.

Devise warden error thrown for authenticate_user in functional Rails test

旧巷老猫 提交于 2020-01-20 03:32:29
问题 I have a resource where the new action requires a user to be logged in to view. If a user tries to create a new resource without being logged in, they are redirected (302'd) to the login page. My functional test looks like this: test "should not get new unless logged in" do get :new assert_response :redirect end The stacktrace looks something like this: ArgumentError: uncaught throw :warden /.../gems/warden-1.1.1/lib/warden/proxy.rb:114:in `throw' /.../gems/ruby-1.9.2-p318/gems/warden-1.1.1

Whitelisting with devise

久未见 提交于 2020-01-19 07:40:39
问题 I am using devise to manage user authentication in my rails app. Devise is really great for that. However I have a special requirement for my application: A user must be whitelisted before he can register as a User. So there is a admin which creates a list of allowed emails. A user registers with a email and if the email is in the whitelist table he will be registered. If however, the mail is not in the whitelist, the registration should be aborted with a message like "You are not yet invited