Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
Add Vagrant support and fix bug when registering with only email
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Wright committed Dec 5, 2012
1 parent fe15319 commit 4c61afb
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .gitmodules
@@ -0,0 +1,15 @@
[submodule "cookbooks/postgresql"]
path = cookbooks/postgresql
url = https://github.com/opscode-cookbooks/postgresql.git
[submodule "cookbooks/openssl"]
path = cookbooks/openssl
url = https://github.com/opscode-cookbooks/openssl.git
[submodule "cookbooks/database"]
path = cookbooks/database
url = https://github.com/opscode-cookbooks/database.git
[submodule "cookbooks/xfs"]
path = cookbooks/xfs
url = https://github.com/opscode-cookbooks/xfs.git
[submodule "cookbooks/build-essential"]
path = cookbooks/build-essential
url = https://github.com/opscode-cookbooks/build-essential.git
29 changes: 29 additions & 0 deletions Vagrantfile
@@ -0,0 +1,29 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant::Config.run do |config|
config.vm.define :flask_social_example_vm do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :hostonly, "192.168.0.10"
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "flask-social-example"
chef.json.merge!({
:postgresql => {
:config => {
:listen_addresses => "*"
},
:password => {
:postgres => "password"
},
:pg_hba => [
{:type => 'local', :db => 'all', :user => 'postgres', :addr => nil, :method => 'trust'},
{:type => 'local', :db => 'all', :user => 'all', :addr => nil, :method => 'trust'},
{:type => 'host', :db => 'all', :user => 'all', :addr => 'all', :method => 'trust'}
]
}
})
end
end
end
2 changes: 1 addition & 1 deletion app/config/app.yml
@@ -1,7 +1,7 @@
COMMON: &common
SECRET_KEY: insecure
SECURITY_POST_LOGIN_VIEW: '/profile'
SQLALCHEMY_DATABASE_URI: postgresql://postgres:password@127.0.0.1:5432/flask_social_example_development
SQLALCHEMY_DATABASE_URI: postgresql://postgres:password@192.168.0.10:5432/flask_social_example_development
ADMIN_CREDENTIALS: 'admin,password'

SECURITY_TRACKABLE: True
Expand Down
2 changes: 1 addition & 1 deletion app/views.py
Expand Up @@ -49,9 +49,9 @@ def register(provider_id=None):
# See if there was an attempted social login prior to registering
# and if so use the provider connect_handler to save a connection
connection_values = session.pop('failed_login_connection', None)
connection_values['user_id'] = user.id

if connection_values:
connection_values['user_id'] = user.id
connect_handler(connection_values, provider)

if login_user(user, remember=True):
Expand Down
1 change: 1 addition & 0 deletions cookbooks/build-essential
Submodule build-essential added at 2e9aad
1 change: 1 addition & 0 deletions cookbooks/database
Submodule database added at eccd31
Empty file.
Empty file.
11 changes: 11 additions & 0 deletions cookbooks/flask-social-example/metadata.rb
@@ -0,0 +1,11 @@
name "flask-social-example"
maintainer "Matt Wright"
maintainer_email "matt@nobien.net"
license "Apache 2.0"
description "Installs and configures various software to run flask-social-example"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1.0"
recipe "flask-social-example", "Installs and configures various software to run flask-social-example"

supports "ubuntu"
depends "database"
15 changes: 15 additions & 0 deletions cookbooks/flask-social-example/recipes/default.rb
@@ -0,0 +1,15 @@

include_recipe "postgresql::server"
include_recipe "database::postgresql"

postgresql_connection_info = {
:host => 'localhost' ,
:port => 5432,
:username => 'postgres',
:password => node['postgresql']['password']['postgres']
}

postgresql_database "flask_social_example_development" do
connection postgresql_connection_info
action :create
end
1 change: 1 addition & 0 deletions cookbooks/openssl
Submodule openssl added at 7f5b84
1 change: 1 addition & 0 deletions cookbooks/postgresql
Submodule postgresql added at 5d7f69
1 change: 1 addition & 0 deletions cookbooks/xfs
Submodule xfs added at d211fe

0 comments on commit 4c61afb

Please sign in to comment.