Vxod
Social and password authorization solution
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
- Fork it ( http://github.com/SergXIIIth/vxod/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request