ruby on rails - Devise, OmniAuth & Facebook - How to let user edit password? -



ruby on rails - Devise, OmniAuth & Facebook - How to let user edit password? -

i'm hoping else has solution issue. allow our users register using facebook (by liking app), , @ same time come in our database users on our site.

upon successful registration seems devise/omniauth creating random password(?). how can allow users edit profile, (and should) default in devise requires come in current password?

i had exact same issue hope solution helpful.

based off details in question assuming next omniauth guide in devise wiki: https://github.com/plataformatec/devise/wiki/omniauth:-overview

in next method:

def self.find_for_facebook_oauth(access_token, signed_in_resource=nil) info = access_token.extra.raw_info if user = user.where(:email => data.email).first user else # create user stub password. user.create!(:email => data.email, :password => devise.friendly_token[0,20]) end end

i changed logic in else block because creating new user in database right away , hashing password them:

else # create new user user =user.new user end

instead made new user after getting facebook info direct them sign page have info populated in form fields can edit , create password.

you need create sure update

def self.new_with_session(params, session)

to add together relevant facebook info grabbed new user , assign new user object fields populated info in sign page. after finish typing password , adding or changing info , click submit create new user. find helpful.

this mash of ideas wiki page on devise , railscast omniauth tutorial: http://railscasts.com/episodes/235-omniauth-part-1

ruby-on-rails facebook devise omniauth

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -