Kelvin
Kelvin

Reputation: 2288

Devise: Remove confirmation

I am using ng-token-auth with devise-token-auth.

This is my user.rb

class User < ActiveRecord::Base
  devise :database_authenticatable, :recoverable,
         :validatable, :omniauthable

  include DeviseTokenAuth::Concerns::User
end

I don't have confirmable listed but everytime I try to register, it tries to send a confirmation email and when I try to login, it says I have to follow the instructions in the email. How can I remove this? I went through the documentation and some posts, I thought that only happens when I have :confirmable in the user.rb. Any help would be appreciated. Thanks!

Upvotes: 3

Views: 1460

Answers (2)

Tetiana Chupryna
Tetiana Chupryna

Reputation: 1074

According to issue#99 in devise_token_auth issue tracker described problem with Confirmable module occurs in versions under 0.1.30 So the possible fix is to upgrade gem version and it should works. Other fix for versions 0.1.30 and below is to actually skip confirmation callback

before_save -> { skip_confirmation! }

P.S. I think that better to not delete my previous answer because of comments section.

Upvotes: 4

Tetiana Chupryna
Tetiana Chupryna

Reputation: 1074

That's strange that your code doesn't work as it pretty close to devise_token_auth documentation example. However maybe this Devise hint helps you:

Add to User model this method

protected
def confirmation_required?
  false
end

Taken from Devise wiki: https://github.com/plataformatec/devise/wiki/How-To:-Add-:confirmable-to-Users#allowing-unconfirmed-access

Hope, it will help you!

Upvotes: 1

Related Questions