devise

Remove devise email validation

▼魔方 西西 提交于 2021-02-11 08:05:27
问题 I use devise and devise-token-auth. I have User model with following content class User < ApplicationRecord devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :authentication_keys => [:login] include DeviseTokenAuth::Concerns::User validates_uniqueness_of :login validates_presence_of :full_name protected def email_required? puts "email_required called" false end end but devise email validation is still working 2.3.0 :003 > user = User.new

uninitialized constant Ability Rails

孤街浪徒 提交于 2021-02-10 16:25:19
问题 I have gone through different solutions given to this problem but none of them is working so please don't try to close the question as duplicate. I have role column in my users table. So user can by admin or user and I need to put permissions on the base of user Role using CanCan . I want to give all permissions to admin. I am logged in as admin but when I access /users I get the error uninitialized constant Ability and when I remove load_and_authorize_resource my cancan permission doesn't

Rails: Devise not sending confirmation email in production (Heroku)

青春壹個敷衍的年華 提交于 2021-02-10 09:32:51
问题 I'm trying to set up email confirmation for new users for my site on Heroku. It works fine in development (it's sent from the correct email, even though I never specified it in development.rb) Here is the code in development.rb: (I was using MailCatcher) config.action_mailer.raise_delivery_errors = true config.action_mailer.default_url_options = { :host => 'localhost:3000'} config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = {:address => "localhost", :port =>

Rspec - Devise login_as does not work on the first test

六月ゝ 毕业季﹏ 提交于 2021-02-08 09:54:38
问题 I have a controller spec that needs a super admin to be logged in to work I followed this guide to and wrote the (paraphrased) following in my tests before(:each) do super_admin = FactoryGirl.create(:super_admin) login_as super_admin, scope: :super_admin end it "does whatever" do get :whatever expect(whatever).to eq(whatever) end it "does something else" do get :something_else expect(something_else).to (something_else) end My problem is that the login is only working for tests past the first,

Rspec - Devise login_as does not work on the first test

浪尽此生 提交于 2021-02-08 09:54:18
问题 I have a controller spec that needs a super admin to be logged in to work I followed this guide to and wrote the (paraphrased) following in my tests before(:each) do super_admin = FactoryGirl.create(:super_admin) login_as super_admin, scope: :super_admin end it "does whatever" do get :whatever expect(whatever).to eq(whatever) end it "does something else" do get :something_else expect(something_else).to (something_else) end My problem is that the login is only working for tests past the first,

Rendering Error with Devise and Mobylette

不羁岁月 提交于 2021-02-08 06:51:20
问题 I am using Mobylette with Devise on my Rails 4 app. When I try to sign up, sign in, or reset my password on my mobile device I get this error: ActionController::MissingRenderer (No renderer defined for format: mobile) Has anyone else had this issue? I've tried setting up a fallback chain mobylette_config do |config| config[:fallback_chains] = { mobile: [:mobile, :html] } end and adding this to the devise initializer config.navigational_formats = ['*/*', :html, :mobile] But continue to get the

How to make Devise respond to both html and json?

浪尽此生 提交于 2021-02-07 20:35:25
问题 I am overriding the Devise Registrations and Sessions controller to respond to both html and json Code for Registration Controller : class RegistrationsController < Devise::RegistrationsController def create @user = User.create(user_params) if @user.save render :json => {:state => {:code => 0}, :data => @user } else render :json => {:state => {:code => 1, :messages => @user.errors.full_messages} } end end private def user_params params.require(:user).permit(:email, :password) end end

How to make Devise respond to both html and json?

橙三吉。 提交于 2021-02-07 20:32:44
问题 I am overriding the Devise Registrations and Sessions controller to respond to both html and json Code for Registration Controller : class RegistrationsController < Devise::RegistrationsController def create @user = User.create(user_params) if @user.save render :json => {:state => {:code => 0}, :data => @user } else render :json => {:state => {:code => 1, :messages => @user.errors.full_messages} } end end private def user_params params.require(:user).permit(:email, :password) end end

Getting turbolinks wrapper to work with Ruby on Rails Devise

巧了我就是萌 提交于 2021-02-07 14:52:49
问题 For my App, I am trying to set up the Turbolinks Mobile wrapper> . I am running into an issue where I can't sign into the App (and thinking the issues is that I need to modify Devise to get it to switch to XHR to work for the mobile). My sign_in form uses Devise but I can't see the code. Using: ruby "2.4.0" gem "rails", "5.0.2" gem "turbolinks", "~> 5.0.0.beta" gem "devise", ">= 4.2.0" gem "devise-async", git: "https://github.com/mhfs/devise-async", branch: "devise-4.x" # for user

Migrate django users to rails

最后都变了- 提交于 2021-02-07 10:19:40
问题 I currently have a system with django which I need to migrate to rails. I am using Devise for authorization in rails. The old django system has it's own set of users which I need to migrate to rails. The thing that I am concerned with, is the password of the users. It is encrypted using sha1 algorithm. So, how I can modify devise such that it is compatible with the old user's password as well. 回答1: Each user gets its own random salt, that way if the table with passwords get leaked, rainbow