Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable confirmable #99

Closed
c0mrade opened this issue Jan 3, 2015 · 9 comments
Closed

Disable confirmable #99

c0mrade opened this issue Jan 3, 2015 · 9 comments

Comments

@c0mrade
Copy link

c0mrade commented Jan 3, 2015

I'm not sure if this is duplicate of #58 or not. After successful login I get this message :
A confirmation email was sent to your account at [email protected]. You must follow the instructions in the email before your account can be activated

So like the README suggest in the section https://github.com/lynndylanhurley/devise_token_auth#excluding-modules I removed the module from my model, this is my model:

user.rb

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

    include DeviseTokenAuth::Concerns::User
    before_save -> do
      skip_confirmation!
    end
  end

I've got a default migration generated by rails generate devise_token_auth:install and there is no way I can get rid of the confirmation email message.

I tried to remove this bit from migration too:

Confirmable

  t.string   :confirmation_token
  t.datetime :confirmed_at
  t.datetime :confirmation_sent_at
  t.string   :unconfirmed_email # Only if using reconfirmable

Which led me to receiving this message :
undefined local variable or method `confirmed_at'

Can't save user via rails c, nor create it with factorygirl in my test.
The only thing that works now is the original migration + this, suggestion from #59 :

  def confirmed_at
      DateTime.now
  end
  def confirmed_at=(val)
  end

  def unconfirmed_email
    self.email
  end
  def unconfirmed_email=(val)
  end

So is there a better way to get rid of these annoying confirmations + possibly the unnecessary email fields?

@lynndylanhurley
Copy link
Owner

Hi, which version are you using? The instructions in the readme are for version 0.1.31.beta1.

@c0mrade
Copy link
Author

c0mrade commented Jan 4, 2015

Hello @lynndylanhurley ,

I'm using 0.1.30, I'll upgrade. Where can I see the current version? And do you have a particular tag/mark when version is stable.

@lynndylanhurley
Copy link
Owner

@c0mrade - the latest stable version is 0.1.30. Here are the docs for that version.

Every release is available on github.

tags

I recommend using the highest version number without a beta suffix.

@c0mrade
Copy link
Author

c0mrade commented Jan 5, 2015

hello @lynndylanhurley thanks. I upgraded to the latest beta version because taking out modules works like written in README.

I have this in my model:
devise :database_authenticatable, :recoverable, :validatable,
:omniauthable

I will close this one as it works for the latest version, sorry about the hassle.

@c0mrade c0mrade closed this as completed Jan 5, 2015
@johnzw89
Copy link

So there's no way to exclude modules in v0.1.30 ? Also trying to exclude the confirmable module. I am getting the error message below when trying to sign in.

undefined local variable or method `confirmed_at' for #User:0x007fbf40cd28a8

It may be because I did not include the confirmable columns in the initial migration...?

@lumir
Copy link

lumir commented Jan 11, 2017

Im getting the same error

@lumir
Copy link

lumir commented Jan 11, 2017

Nevermind, my issue was fixed putting the include DeviseTokenAuth::Concerns::User after my own devise modules definition on model.

@georgyangelov
Copy link

@lumir, thank you! This solved my problem as well. Seems like the include tries to find devise configuration and if it can't creates a default one.

@anthony-bernardo
Copy link

anthony-bernardo commented Jan 4, 2018

I have the same error with :

class AppUser < ApplicationRecord
  devise :database_authenticatable, :lockable,
         :recoverable, :trackable, :validatable, password_length: 6..32
  include DeviseTokenAuth::Concerns::User

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants