devise

API signin to generate token using devise in rails 4

吃可爱长大的小学妹 提交于 2020-08-05 10:57:10
问题 I am implementing api via rails. I want to implement following feature but unable to figure out how? I tried this sample app I have user model with email, password and access_token class UsersController < ApplicationController def signin c_user = User.find_by_email(params[:email]) pass = params[:password] if c_user.password == pass render json: c_user.access_token end end private def users_params params.require(:user).permit(:email, :password) end end If user request via api for http:/

EOFError in Devise::PasswordsController#create

时光总嘲笑我的痴心妄想 提交于 2020-08-05 09:50:50
问题 I am running into an issue with mailing password resets from my Ruby on Rails application. The password reset mailing used to work, however, now it does not. Password resets are the only emails that the server sends. Once I submit the email that I'd like to get a password for, Rails displays this on full trace: EOFError in Devise::PasswordsController#create end of file reached Rails.root: /home/path/to/app /usr/lib/ruby/1.9.1/openssl/buffering.rb:174:in `sysread_nonblock' /usr/lib/ruby/1.9.1

EOFError in Devise::PasswordsController#create

狂风中的少年 提交于 2020-08-05 09:50:32
问题 I am running into an issue with mailing password resets from my Ruby on Rails application. The password reset mailing used to work, however, now it does not. Password resets are the only emails that the server sends. Once I submit the email that I'd like to get a password for, Rails displays this on full trace: EOFError in Devise::PasswordsController#create end of file reached Rails.root: /home/path/to/app /usr/lib/ruby/1.9.1/openssl/buffering.rb:174:in `sysread_nonblock' /usr/lib/ruby/1.9.1

On destroying session via Devise “Couldn't find User with 'id'=sign_out”

天大地大妈咪最大 提交于 2020-07-31 04:52:49
问题 I'm running Rails 5.1.2 and Ruby 2.4.0. I've created a method in the ApplicationController called require_login that checks if the user is logged in order not. If and only if they aren't logged in, they are forwarded to the login page. The problem is that when I sign them out, I get the following error ActiveRecord::RecordNotFound at /users/sign_out Couldn't find User with 'id'=sign_out With the culprit line being: def show @user = User.find(params[:id]) # right here authorize @user end from

On destroying session via Devise “Couldn't find User with 'id'=sign_out”

百般思念 提交于 2020-07-31 04:51:22
问题 I'm running Rails 5.1.2 and Ruby 2.4.0. I've created a method in the ApplicationController called require_login that checks if the user is logged in order not. If and only if they aren't logged in, they are forwarded to the login page. The problem is that when I sign them out, I get the following error ActiveRecord::RecordNotFound at /users/sign_out Couldn't find User with 'id'=sign_out With the culprit line being: def show @user = User.find(params[:id]) # right here authorize @user end from

gem devise how to add comment created user email?

浪尽此生 提交于 2020-07-23 04:55:28
问题 I am using gem devise for creating users profile Each user can create a comment. I need to add the user name beside each comment something like this <%= @comment.user.name %> in user.rb has_many :comments, dependent: :destroy in comment.rb belongs_to :users in comment controller before_action :find_comment ,only:[:show,:update,:edit,:destroy] def new @user =User.find(params[:id]) @comment = @user.comments.build end def create @user =User.find(params[:id]) @comment = @user.comments.build

gem devise how to add comment created user email?

本秂侑毒 提交于 2020-07-23 04:54:16
问题 I am using gem devise for creating users profile Each user can create a comment. I need to add the user name beside each comment something like this <%= @comment.user.name %> in user.rb has_many :comments, dependent: :destroy in comment.rb belongs_to :users in comment controller before_action :find_comment ,only:[:show,:update,:edit,:destroy] def new @user =User.find(params[:id]) @comment = @user.comments.build end def create @user =User.find(params[:id]) @comment = @user.comments.build

Setting up DoorKeeper with multiple Rails/React applications?

孤街浪徒 提交于 2020-07-10 08:38:06
问题 I've built multiple Rails/React applications for my company (all in one using Rails 6. Rails renders json to React). All applications will be on the same domain and eventually, access rights will be done via VPN. For now, I would like to build a Single Sign On app that would give a list of apps to choose from (Accounts, Dashboard, Audits, etc). Based on the users credentials, they may or may not have certain privileges on these applications. I appears that the Doorkeeper Gem is the way to go

How to send confirmation emails with devise?

守給你的承諾、 提交于 2020-07-09 19:39:29
问题 Here is my user model: class User < ApplicationRecord # Include default devise modules. Others available are: # :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable end How should I configure devise to send confirmation emails when the user signs up? 回答1: For production, you need to configure a third-party email sending service, like sendgrid. Example: register on heroku.com push the your local app repo to github

Changing devise default layouts

我们两清 提交于 2020-07-04 10:45:28
问题 I'm trying to get devise to display a different layout template from the defaults for certain aspects. I have this working when the user goes to the login page, but I need to display a different layout for sign up, forgotten password, and reset. This is the current code in my application controller: layout :layout private def layout # only turn it off for login pages: is_a?(Devise::SessionsController) ? "login" : "application" # or turn layout off for every devise controller: #devise