devise

Can't create new user with ActiveAdmin

↘锁芯ラ 提交于 2020-01-10 04:39:06
问题 I just added active admin to my rails app and I'm unable to create a new user. I am using the user model that active admin creates with a few added columns like first and last name. When I fill out the form for a new user and click create new user, that page refreshes but doesn't save my user and doesn't go to the recap page with the successful message. here is my AdminUser model class AdminUser < ActiveRecord::Base devise :database_authenticatable, :recoverable, :rememberable, :trackable,

Ruby on Rails Devise code after login

我的未来我决定 提交于 2020-01-10 01:35:34
问题 I have an RoR app using Devise for logins. There is some code that is executed when a new User record is created, by being put in the user.rb file as an after_create call/macro/whatever. I need to make this code run after each login, instead of running on new user creation. With some Googling, it seems that one option is to place Warden callbacks in the devise.rb code. My questions are: Is this right, and/or is there a better way to do this? If this is the right approach ... Should the Warden

Devise Add Admin Role [closed]

◇◆丶佛笑我妖孽 提交于 2020-01-07 09:55:10
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . I wish to know how to create an admin role in devise gem and how to make pages that just if you are logged as admin you could access, otherwise you get a 404 page. 回答1: There is a simplistic way of doing this that I will share with you. Create a migration that adds a boolean to your devise user:

Route devise to different controller/view set

萝らか妹 提交于 2020-01-07 06:16:07
问题 I'm trying to achieve the following: I have a simple page where a visitor can view a list of albums (index action) and by clicking on any of the albums, view the photos of every album (show action). No other actions (edit, new, update, destroy) should be reachable. When the user logs in she can see the index and show pages, plus all the other actions should be available, but now index and show will lock differently. The URLs shouldn't show up any different from before, though. I created these

Rails devise redirecting to '/users' instead of '/users/sign_up' on failed registration

好久不见. 提交于 2020-01-07 04:18:28
问题 I've been searching all over to fix this - when a user fails a registration create using Devise, for whatever reason they get redirected to '/users' instead of staying on '/users/sign_up' and persisting the errors: Here are my routes: devise_for :users, controllers: { sessions: 'users/sessions', confirmations: 'users/confirmations', registrations: 'users/registrations', passwords: 'users/passwords', invitations: 'users/invitations' }, sign_out_via: [:get, :delete] And /users/registrations

How to have root view when user is not logged in rails?

余生颓废 提交于 2020-01-07 03:16:13
问题 I am building a rails app and I use Devise for authentication. I want to show a product first page when user comes to www.mydomain.com instead of www.mydomain.com/users/sign_in which is devise default! I will also want to show a different root view when user is logged in. This feels like a very common use case, is there a easy way to do this? Is this there in documentation or can anyone help me with this? 回答1: You can use the authenticate route helper to add a constraint on the routes so that

formValidation jquery plugin submitting a blank devise registration form on rails

假装没事ソ 提交于 2020-01-06 15:59:29
问题 I am using the formValidation query plugin for my Devise registration form. The plugin is from formValidation.io . I can get the form to register valid or invalid entries, but it always submits a blank form. For some reason the form is showing that it's filled out, but I keep getting errors saying that the required fields can't be blank. When I look at the trace, the sign up info IS being registered there...but it's getting lost somewhere along the line. trace: Started POST "/users" for ::1

devise : new user registration issues , PG::ProtocolViolation . Rails4, Postgres

Deadly 提交于 2020-01-06 15:13:39
问题 I am using devise and omni-auth to login with linkedin . I added the from_omniauth method to user model as mentioned in the Railscast: This is the code: #Create a new user if does not exist def self.from_omniauth(auth) where(auth.slice(:provider, :uid)).first_or_create! do |user| user.provider = auth.provider user.uid = auth.uid user.email = auth.info.email end end Started GET "/users/auth/linkedin/callback?oauth_token=XXX" INFO -- omniauth: (linkedin) Callback phase initiated. Processing by

Rails and devise: model attribute not being persisted

我是研究僧i 提交于 2020-01-06 14:41:58
问题 I edited devise's RegistrationsController::create method to modify slightly the behaviour. What I'm trying to do is that if there are no admin users in the database, the one that first signs up is going to be assigned the admin role, else it will be a regular user. However, the role, though assigned correctly to the object (tested), it's not being persisted to the database. Model: class User < ActiveRecord::Base devise :database_authenticatable, :registerable, :recoverable, :rememberable,

NoMethodError - undefined method `reset_password_token' for User:Class:

给你一囗甜甜゛ 提交于 2020-01-06 14:04:55
问题 In my Rails application, I have a form for admin to create normal users. In create action , I am generating a reset password token, and sending a welcome mail to the user, with a link in it to reset his password. This is my code. @user = User.new params[:user] @user.reset_password_token = User.reset_password_token @user.reset_password_sent_at = Time.now.utc if @user.save UserMailer.welcome_email(@user).deliver .. This works fine, but I have another app with the same code, but uses devise 3.2