Skip to content

SergXIIIth/vxod

Repository files navigation

Vxod

Social and password authorization solution

Build Status Code Climate Dependency Status Gem Version

Login

Features

  • openid registration/login
  • require email in openid registration
  • password base registration/login
  • checkbox auto-generate password and send to email
  • reset password

Future

  • profile with password reset, link other openid servises to user
  • adminka for user management
  • support Sinatra, Mongoid, Rails, ActiveRecord, any Rack app, any DB

Setup

Gemfile

  gem 'omniauth'
  gem 'omniauth-twitter'
  gem 'omniauth-vkontakte'
  gem 'omniauth-facebook'
  gem 'omniauth-google-oauth2'
  gem 'omniauth-github'
  gem 'vxod'

app.rb

  enable :sessions
  set :sessions, secret: ENV['secret_secret']

  use OmniAuth::Builder do
    provider :twitter, ENV['omniauth.twitter'], ENV['omniauth.twitter_x']
    provider :vkontakte, ENV['omniauth.vkontakte'], ENV['omniauth.vkontakte_x']
    provider :facebook, ENV['omniauth.facebook'], ENV['omniauth.facebook_x']
    provider :google_oauth2, ENV['omniauth.google'], ENV['omniauth.google_x']
    provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
  end

  use Vxod::Middleware

  # render middware html in app layout
  %w(get post).each do |method|
    app.send(method, '*') do
      if env['VXOD.HTML']
        slim :vxod_layout, locals: { html: env['VXOD.HTML'] }
      else
        pass
      end
    end
  end

config/smtp.rb

Pony.options = {
  from: '???',
  via: :smtp,
  via_options: {
    address:      'smtp.yandex.ru',
    port:         '587',
    smtp_domain:  '???',
    user_name:    '???',
    password:     '???',

    enable_starttls_auto: true,
    authentication: :plain, # :plain, :login, :cram_md5, no auth by default
  }
}

helpers.rb

helpers do
  def vxod
    @vxod ||= Vxod.api(self)
  end
end

Usage

p = vxod.user.email get current user

Contributing

  1. Fork it ( http://github.com/SergXIIIth/vxod/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

Social and password authorization Rack middleware

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages