spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

When using Omniauth in Rails, Google_omniauth2 creates a new user if the user exists and use different auth


Found the answer! In the user.rb file, it checks whether the email is verified by Facebook or not by accessing 'auth.verified' attribute. It will only take the email and check for an existing account if it's verified. The problem is,Google does not provide that attribute. So, if someone authenticate with Google I will bypass the verification like this :

  if auth.provider == 'google_oauth2'
    email = auth.info.email
  else
    email_is_verified = auth.info.email &&
(auth.info.verified || auth.info.verified_email)
    email = auth.info.email if email_is_verified
  end

Categories : Ruby On Rails

Related to : When using Omniauth in Rails, Google_omniauth2 creates a new user if the user exists and use different auth
Rails creates excess child record when saving with accepts_nested_attributes_for
My fault, it should be @payment_profile = PaymentProfile.new(payment_profile_params) instead of @payment_profile = @user.payment_profiles.build(payment_profile_params) rails was creating join model automatically

Categories : Ruby On Rails
Saving multiple updates and creates as one transaction - ruby rails
Although, its a bit difficult to understand what exactly your requirement is but as far I understand this is what you want, In Rails 3 - PlayerType.find_or_initialize_by(id: p_type_params[:player_id]) And in rails 4 - PlayerType.where(id: p_type_params[:player_id]).first_or_initialize The above code will either find or initialise a new record in the table, Note: You can also use find_or_cre

Categories : Ruby On Rails
My exists function says the file exists, but winapi functions say it does not
Problem 1: String Conversions Your primary problem is that you are attempting to use LPCWSTR (a const wchar_t *) and const char * interchangeably. I see a number of issues in your source, in particular: You start with const char * image_name. You then cast it to a LPCWSTR to pass to SetWallpaper. This basically guarantees that SetWallpaper will fail, as desktop->SetWallpaper is not able to h

Categories : Image
Rails Google Font Cache
Font should cache and so should Google fonts do. See also; https://developers.google.com/fonts/faq#Performance: If a page uses web fonts, then the font files have to be downloaded to the site visitor's computer before they can be displayed initially. The font files are served compressed for a faster download. After that initial download, they will be cached in the browser. As the Google

Categories : CSS
undefined local variable or method `user' omniauth callbacks controller
The problem is in the password_required? which is called when the user is saved. def password_required? super && user.blank? end Its trying to test whether the user is blank? However the user variable/method does not exist in its scope. Instead you need to use self which refers to the current instance of User. So the line should be: super && self.blank? or just: super &a

Categories : Ruby On Rails
Recently Add
Groups and Users has many oder has many through?
Rails format specifier differences
Capistrano can not create symlinks: file exist
Admin can't delete users. Ruby on Rails 3 - Michael Hartl
Don't show user name who create post
Using Wicked with Devise (2 step signup process)
RubyOnRails Rake test failures
Rails session start event handler
Why ActiveModel::ForbiddenAttributesError error?
How can i track the issue in production RAILS
Cannot install spree gem - ERROR: invalid gem: package is corrupt
Why are the nested resources for Devise authentication not working?
Rails Devise - how to open access to the site root
Rails: respond_with the same template for two methods
rails with postgresl database "role postgres does not exist"
Instance variable in Rails helper not set
Monkey patch rails 3.2 rake task
Rails_admin: Should I have admin_user or user with admin role to manage users and admin panel
undefined method `attachments' for nil:NilClass
Memory usage increase with Ruby 2.1 versus Ruby 2.0 or 1.9
Can a Rails app be deployed without using Heroku Toolbelt? If so, how?
Enable random access to collection with MongoDB
libmysqlclient-dev installation fails
undefined method `name' for nil:NilClass. Can't find @followed.name but @followed is set
Allowing an arbitrary domain and subdomain in session_store.rb
Pushmeup Gem - Can't send push notifications in Active Admin model
Rails console does not start
GitHub Import: Could not locate Gemfile
AWS::S3::PermanentRedirect in SongsController#index "The bucket you are attempting to access must be addressed using the specified endpoint"
automatically create ActiveRecord parent for association
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.