devise

Latest omniauth-facebook gem breaks devise

拟墨画扇 提交于 2021-02-20 09:45:48
问题 ruby '2.6.3' gem 'rails', '~> 6.0.2', '>= 6.0.2.1' I'm using the latest omniauth-facebook and devise together Gemfile: gem 'devise' gem 'omniauth-facebook' Getting this error when starting the server: /versions/2.6.3/lib/ruby/gems/2.6.0/gems/devise-4.7.3/lib/devise/omniauth.rb:12:in `': You are using an old OmniAuth version, please ensure you have 1.0.0.pr2 version or later installed. (RuntimeError) The problem is that if I try to use older omniauth-facebook versions the server works but then

Latest omniauth-facebook gem breaks devise

对着背影说爱祢 提交于 2021-02-20 09:41:56
问题 ruby '2.6.3' gem 'rails', '~> 6.0.2', '>= 6.0.2.1' I'm using the latest omniauth-facebook and devise together Gemfile: gem 'devise' gem 'omniauth-facebook' Getting this error when starting the server: /versions/2.6.3/lib/ruby/gems/2.6.0/gems/devise-4.7.3/lib/devise/omniauth.rb:12:in `': You are using an old OmniAuth version, please ensure you have 1.0.0.pr2 version or later installed. (RuntimeError) The problem is that if I try to use older omniauth-facebook versions the server works but then

How do I validate certain fields with rails devise on registration only

拈花ヽ惹草 提交于 2021-02-19 04:06:55
问题 I have a set of custom fields attached to a devise model called Entrant. I have two forms, one for registration form (three fields) and one which sits in the account area (12 fields). Most of the custom fields area required but only within the form the sits in the account area. How do I achieve this? I am using rails 4.2 and ruby 2.1 回答1: You can simply specify validations on actions, that is: validates :name, presence: true, on: :create # which won't validate presence of name on update

How do I validate certain fields with rails devise on registration only

让人想犯罪 __ 提交于 2021-02-19 04:04:31
问题 I have a set of custom fields attached to a devise model called Entrant. I have two forms, one for registration form (three fields) and one which sits in the account area (12 fields). Most of the custom fields area required but only within the form the sits in the account area. How do I achieve this? I am using rails 4.2 and ruby 2.1 回答1: You can simply specify validations on actions, that is: validates :name, presence: true, on: :create # which won't validate presence of name on update

How to send two different emails for devise confirmable and devise reconfirmable?

…衆ロ難τιáo~ 提交于 2021-02-19 01:34:53
问题 Both devise confirmable (email confirmation when user signs up) and reconfirmable (email confirmation when user changes email) modules send the same email template, "confirmation_instructions". How do I get it so that a different email template is used for confirmable? 回答1: You can override options[:template_name] in the #confirmation_instructions method of your mailer. class AuthMailer < Devise::Mailer helper :application include Devise::Controllers::UrlHelpers default template_path: 'devise

undefined local variable or method `flash' for #<Devise::OmniauthCallbacksController:0x007fb5d1741e48>

你。 提交于 2021-02-18 06:41:31
问题 I am building a Rails-API using Omniauth-facebook and Devise-token-auth with Angular and ng-token-auth for the frontend. However when logging in with facebook I am presented with the error: undefined local variable or method `flash' for #<Devise::OmniauthCallbacksController:0x007fd027a51e10> It seems omniauth automatically uses flash middleware however the rails-api doesn't include this and I have been unsuccessfully disabling the use of flash with omniauth. My configuration is as below:

How to access current_user with devise-token_authenticatable gem?

孤街浪徒 提交于 2021-02-11 15:27:16
问题 I’m working on a small project that is using devise and devise-token_authenticatable in a Rails/GraphQL/Apollo/React setup. Project is setup using webpacker , so the front and back ends are both served from the same domain. Sign-in, register, log-out are all handle by the front end (React). I also need to point out this is not an API only app. It seems, server is not setting the current_user or the proper cookie and I’m getting a network error. Heroku logs shows the following error:

How to access current_user with devise-token_authenticatable gem?

可紊 提交于 2021-02-11 15:26:26
问题 I’m working on a small project that is using devise and devise-token_authenticatable in a Rails/GraphQL/Apollo/React setup. Project is setup using webpacker , so the front and back ends are both served from the same domain. Sign-in, register, log-out are all handle by the front end (React). I also need to point out this is not an API only app. It seems, server is not setting the current_user or the proper cookie and I’m getting a network error. Heroku logs shows the following error:

Authenticate static files with Devise?

两盒软妹~` 提交于 2021-02-11 13:20:53
问题 I have a static Jekyll support page on my site served in /public/support . The main rails app is behind devise - the whole thing. If you are not authenticated you get kicked back to the login. Can I 'hide' this static site behind the Devise authentication - i.e. only allow access to the static pages when authenticated? 回答1: I ended up finding this: https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-subrequest-authentication/ In my NGINX config I have this: location

Remove devise email validation

与世无争的帅哥 提交于 2021-02-11 08:10:33
问题 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