Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

aavkontakte-rails3

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aavkontakte-rails3


Version published
Maintainers
1
Created
Source

= aavkontakte-rails3

This is aavkontakte-rails3 - yet another authlogic vkontakte authorization gem. It provides vkontakte authorization to authlogic. This gem is tested with authlogic and authlogic-rpx on my project. Please report me about bugs. Vkontakte uses domain protection for url address of your site. But I noticed that: http://your-really-domain:3000 after closing popup window is works too. You must add your domain in /etc/hosts

== Install

gem install aavkontakte-rails3

  • Environment

In environment.rb:

config.gem 'aavkontakte-rails3'

  • User model

Add following line:

acts_as_authentic do |c| c.vkontakte_enabled = { :vk_app_id => "id", :vk_app_password => "password" } c.vkontakte_merge_enabled true # mapping user data from vkontakte to new user account, true by default end

  • UserSession model:

By default "vkontakte_merge_enabled" uses "map_vkontakte_data" method:

private def map_vkontakte_data self.attempted_record.send("#{klass.login_field}=", @vkontakte_data[:user][:nickname]) if self.attempted_record.send(klass.login_field).blank? self.attempted_record.send("first_name=", @vkontakte_data[:user][:first_name]) if @vkontakte_data[:user][:first_name] self.attempted_record.send("last_name=", @vkontakte_data[:user][:last_name]) if @vkontakte_data[:user][:last_name] end

If you set option to true, you need override it in user_session model.

  • Migrations

Create migration "script/generate migration add_vkontakte_id_to_user vk_id:string":

class AddVkontakteIdToUser < ActiveRecord::Migration def self.up add_column :users, :vk_id, :string # You must remove any database constraints for fields: # change_column :users, :crypted_password, :string, :null => true # change_column :users, :password_salt, :string, :null => true # change_column :users, :login, :string, :null => true end

def self.down
  remove_column :users, :vk_id
  # change_column :users, :crypted_password, :string, :null => false
  # change_column :users, :password_salt, :string, :null => false
  # change_column :users, :login, :string, :null => false
end

end

  • Layout

In the body section:

<%= init_vkontakte %>

  • Javascripts

After first start your application, it's copying vkontakte.js to your javascripts directory or if it doesn't exist.

  • Link

Put link somewhere, where you want:

<%= vkontakte_login_link_to "Login with vkontakte" %>

By default it uses action create of user_sessions controller. Parameters are identical link_to without block.

== Contributing to aavkontakte-rails3

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

== Copyright

Copyright (c) 2011 Dmitry Vorotilin. See LICENSE.txt for further details.

FAQs

Package last updated on 17 Sep 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc