Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Is it possible to skip confirmation email and confirm user?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  12 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Christian Fazzini  
View profile  
 More options Sep 27 2010, 4:56 pm
From: Christian Fazzini <christian.fazz...@gmail.com>
Date: Mon, 27 Sep 2010 13:56:19 -0700 (PDT)
Local: Mon, Sep 27 2010 4:56 pm
Subject: Is it possible to skip confirmation email and confirm user?
When doing the following:

user = User.create(
  :first_name            => 'admin',
  :last_name             => 'admin',
  :email                 => 'foo...@email.com',
  :password              => 'password1',
  :password_confirmation => 'password1'
)

# Confirm the user for Devise
user.confirm!

The above creates the user in the db and confirms the user. However,
in the background, Devise also sends out an email, along the lines of
"Welcome foo...@email.com! You can confirm your account through the
link below: Confirm my account".

Is it possible to skip the confirmation email and just confirm this
user for this instance?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlos Antonio da Silva  
View profile  
 More options Sep 27 2010, 5:03 pm
From: Carlos Antonio da Silva <carlosantoniodasi...@gmail.com>
Date: Mon, 27 Sep 2010 18:03:33 -0300
Local: Mon, Sep 27 2010 5:03 pm
Subject: Re: [devise] Is it possible to skip confirmation email and confirm user?

Yes it is: call skip_confirmation! and then save the record

http://github.com/plataformatec/devise/blob/master/lib/devise/models/...

On Mon, Sep 27, 2010 at 5:56 PM, Christian Fazzini <

--
At.
Carlos A. da Silva

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Fazzini  
View profile  
 More options Sep 27 2010, 5:10 pm
From: Christian Fazzini <christian.fazz...@gmail.com>
Date: Mon, 27 Sep 2010 14:10:57 -0700 (PDT)
Local: Mon, Sep 27 2010 5:10 pm
Subject: Re: Is it possible to skip confirmation email and confirm user?
You mean like this:

user = User.create(
  :first_name            => 'admin',
  :last_name             => 'admin',
  :email                 => 'foo...@email.com',
  :password              => 'password1',
  :password_confirmation => 'password1'
).skip_confirmation!

On Sep 28, 5:03 am, Carlos Antonio da Silva


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlos Antonio da Silva  
View profile  
 More options Sep 27 2010, 5:18 pm
From: Carlos Antonio da Silva <carlosantoniodasi...@gmail.com>
Date: Mon, 27 Sep 2010 18:18:13 -0300
Local: Mon, Sep 27 2010 5:18 pm
Subject: Re: [devise] Re: Is it possible to skip confirmation email and confirm user?

IIRC, skip_confirmation! does not save the record, so you'd have to do sth
like:

user = User.create(params here)
user.skip_confirmation!
user.save!

On Mon, Sep 27, 2010 at 6:10 PM, Christian Fazzini <

--
At.
Carlos A. da Silva

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Fazzini  
View profile  
 More options Sep 27 2010, 6:56 pm
From: Christian Fazzini <christian.fazz...@gmail.com>
Date: Mon, 27 Sep 2010 15:56:48 -0700 (PDT)
Local: Mon, Sep 27 2010 6:56 pm
Subject: Re: Is it possible to skip confirmation email and confirm user?
Nope, that wont work. Devise sends the email when the user is created.
I am still getting confirmation emails. So I don't think it ever
reaches skip_confirmation!

I think .create triggers the email to be sent

On Sep 28, 5:18 am, Carlos Antonio da Silva


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Fazzini  
View profile  
 More options Sep 27 2010, 7:02 pm
From: Christian Fazzini <christian.fazz...@gmail.com>
Date: Mon, 27 Sep 2010 16:02:37 -0700 (PDT)
Local: Mon, Sep 27 2010 7:02 pm
Subject: Re: Is it possible to skip confirmation email and confirm user?
On the other hand,

user = User.new(params here)
user.skip_confirmation!
user.save!

Works! :-)

On Sep 28, 5:18 am, Carlos Antonio da Silva


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlos Antonio da Silva  
View profile  
 More options Sep 27 2010, 7:03 pm
From: Carlos Antonio da Silva <carlosantoniodasi...@gmail.com>
Date: Mon, 27 Sep 2010 20:03:26 -0300
Local: Mon, Sep 27 2010 7:03 pm
Subject: Re: [devise] Re: Is it possible to skip confirmation email and confirm user?

Sure, we were using User.create =D

On Mon, Sep 27, 2010 at 8:02 PM, Christian Fazzini <

--
At.
Carlos A. da Silva

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Fazzini  
View profile  
 More options Sep 27 2010, 7:19 pm
From: Christian Fazzini <christian.fazz...@gmail.com>
Date: Mon, 27 Sep 2010 16:19:29 -0700 (PDT)
Local: Mon, Sep 27 2010 7:19 pm
Subject: Re: Is it possible to skip confirmation email and confirm user?
Ok this seems to work for seeds.

Now I am trying to authenticate the user through facebook. I get this
error:

NoMethodError in Devise/oauth callbacksController#facebook
undefined method `persisted?' for true:TrueClass

In my user model, I have:

def self.find_for_facebook_oauth(access_token, signed_in_resource=nil)
    data = ActiveSupport::JSON.decode(access_token.get('https://
graph.facebook.com/me?'))

    if user = User.find_by_email(data['email'])
      user
    else
      # Create an user with a stub password.
      user = User.new(
        :email                   => data['email'],
        :first_name              => data['first_name'],
        :last_name               => data['last_name'],
        :password                => 'password123',
        :password_confirmation   => 'password123'
      )
      user.skip_confirmation!
      user.save!
    end
  end

However, with the following code below, everything seems to work...
Why is this error coming up?

Arent both methods the same?

def self.find_for_facebook_oauth(access_token, signed_in_resource=nil)
    data = ActiveSupport::JSON.decode(access_token.get('https://
graph.facebook.com/me?'))

    if user = User.find_by_email(data['email'])
      user
    else
      # Create an user with a stub password.
      user = User.create!(
        :email                   => data['email'],
        :first_name              => data['first_name'],
        :last_name               => data['last_name'],
        :password                => 'password123',
        :password_confirmation   => 'password123'
      )
    end
  end

On Sep 28, 7:03 am, Carlos Antonio da Silva


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex  
View profile  
 More options Sep 27 2010, 7:31 pm
From: Alex <x37v.a...@gmail.com>
Date: Mon, 27 Sep 2010 16:31:21 -0700
Local: Mon, Sep 27 2010 7:31 pm
Subject: Re: [devise] Re: Is it possible to skip confirmation email and confirm user?
The stub method that is given for git and facebook when I saw it in
some blogs, is incorrect, I believe.

You need to return 'user'.
user.save! returns true on success...

To fail gracefully, you return a User instance that you have not saved
to the database, so the version of save that raises an exception is
probably not what you want.

-Alex

On Mon, Sep 27, 2010 at 4:19 PM, Christian Fazzini


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christian Fazzini  
View profile  
 More options Sep 28 2010, 2:56 am
From: Christian Fazzini <christian.fazz...@gmail.com>
Date: Mon, 27 Sep 2010 23:56:59 -0700 (PDT)
Local: Tues, Sep 28 2010 2:56 am
Subject: Re: Is it possible to skip confirmation email and confirm user?
Thanks Alex. Yea, I now have it as:

      user = User.new(
        :email                   => data['email'],
        :first_name              => data['first_name'],
        :last_name               => data['last_name'],
        :password                => 'password123',
        :password_confirmation   => 'password123'
      )
      user.skip_confirmation!
      user.save!

      user

I am returning the user object. This seems to work now.

By the way, when I try to use Devise.friendly_token, as such:
User.create!(:email => data['email'], :password =>
Devise.friendly_token), I always get "password is too long, maximum is
20" (or similar message). It seems Devise.friendly_token as given in
the git examples is wrong?

http://github.com/plataformatec/devise/wiki/OAuth2:-Overview
http://github.com/plataformatec/devise/wiki/OAuth2:-Testing

I tried increasing the password limit of Devise to 50 characters, and
Devise.friendly_token still provides a longer type of password...

FYI, I am following: http://stjhimy.com/posts/14-allowing-devise-login-with-facebook-account

On Sep 28, 7:31 am, Alex <x37v.a...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlos Antonio da Silva  
View profile  
 More options Sep 28 2010, 7:22 am
From: Carlos Antonio da Silva <carlosantoniodasi...@gmail.com>
Date: Tue, 28 Sep 2010 08:22:38 -0300
Local: Tues, Sep 28 2010 7:22 am
Subject: Re: [devise] Re: Is it possible to skip confirmation email and confirm user?

I guess friendly_token is 60 chars lenght, so you could do sth like:
Devise.friendly_token[0,20]

On Tue, Sep 28, 2010 at 3:56 AM, Christian Fazzini <

--
At.
Carlos A. da Silva

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex  
View profile  
 More options Sep 28 2010, 12:09 pm
From: Alex <x37v.a...@gmail.com>
Date: Tue, 28 Sep 2010 09:09:28 -0700
Local: Tues, Sep 28 2010 12:09 pm
Subject: Re: [devise] Re: Is it possible to skip confirmation email and confirm user?
I believe you want to use the non bang version of save as well, this
way you return an unsaved model if save fails, you don't throw an
exception.

-Alex

On Mon, Sep 27, 2010 at 11:56 PM, Christian Fazzini


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »