removed unique index on email to a regular index in order to make inviting users through fb work (no email present)
This commit is contained in:
parent
be57170bf9
commit
6242ac64ed
6 changed files with 32 additions and 20 deletions
4
Gemfile
4
Gemfile
|
|
@ -11,8 +11,8 @@ gem 'nokogiri', '1.4.3.1'
|
||||||
gem "fog"
|
gem "fog"
|
||||||
|
|
||||||
#Security
|
#Security
|
||||||
gem 'devise', '1.2.rc'
|
gem 'devise', '1.1.3'
|
||||||
gem 'devise_invitable', :git => 'git://github.com/zhitomirskiyi/devise_invitable.git'
|
gem 'devise_invitable', :git => 'git://github.com/zhitomirskiyi/devise_invitable.git', :branch => '0.3.5'
|
||||||
|
|
||||||
#Authentication
|
#Authentication
|
||||||
gem 'omniauth', '0.1.6'
|
gem 'omniauth', '0.1.6'
|
||||||
|
|
|
||||||
18
Gemfile.lock
18
Gemfile.lock
|
|
@ -46,11 +46,11 @@ GIT
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/zhitomirskiyi/devise_invitable.git
|
remote: git://github.com/zhitomirskiyi/devise_invitable.git
|
||||||
revision: 5f74da32a81a2332bac266316dab333a4eed9525
|
revision: 85abb5fef4ab4f74db818ed3d8104c2f7d24b94e
|
||||||
|
branch: 0.3.5
|
||||||
specs:
|
specs:
|
||||||
devise_invitable (0.4.rc)
|
devise_invitable (0.3.5)
|
||||||
devise (~> 1.2.rc)
|
devise (~> 1.1.0)
|
||||||
rails (~> 3.0.0)
|
|
||||||
|
|
||||||
PATH
|
PATH
|
||||||
remote: vendor/gems/jasmine
|
remote: vendor/gems/jasmine
|
||||||
|
|
@ -145,10 +145,9 @@ GEM
|
||||||
culerity (0.2.15)
|
culerity (0.2.15)
|
||||||
daemons (1.1.0)
|
daemons (1.1.0)
|
||||||
database_cleaner (0.6.0)
|
database_cleaner (0.6.0)
|
||||||
devise (1.2.rc)
|
devise (1.1.3)
|
||||||
bcrypt-ruby (~> 2.1.2)
|
bcrypt-ruby (~> 2.1.2)
|
||||||
orm_adapter (~> 0.0.2)
|
warden (~> 0.10.7)
|
||||||
warden (~> 1.0.2)
|
|
||||||
diff-lcs (1.1.2)
|
diff-lcs (1.1.2)
|
||||||
erubis (2.6.6)
|
erubis (2.6.6)
|
||||||
abstract (>= 1.0.0)
|
abstract (>= 1.0.0)
|
||||||
|
|
@ -264,7 +263,6 @@ GEM
|
||||||
oa-enterprise (= 0.1.6)
|
oa-enterprise (= 0.1.6)
|
||||||
oa-oauth (= 0.1.6)
|
oa-oauth (= 0.1.6)
|
||||||
oa-openid (= 0.1.6)
|
oa-openid (= 0.1.6)
|
||||||
orm_adapter (0.0.4)
|
|
||||||
polyglot (0.3.1)
|
polyglot (0.3.1)
|
||||||
pyu-ruby-sasl (0.0.3.2)
|
pyu-ruby-sasl (0.0.3.2)
|
||||||
rack (1.2.1)
|
rack (1.2.1)
|
||||||
|
|
@ -351,7 +349,7 @@ GEM
|
||||||
uuidtools (2.1.1)
|
uuidtools (2.1.1)
|
||||||
vegas (0.1.8)
|
vegas (0.1.8)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
warden (1.0.3)
|
warden (0.10.7)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
webmock (1.6.2)
|
webmock (1.6.2)
|
||||||
addressable (>= 2.2.2)
|
addressable (>= 2.2.2)
|
||||||
|
|
@ -374,7 +372,7 @@ DEPENDENCIES
|
||||||
cloudfiles (= 1.4.10)
|
cloudfiles (= 1.4.10)
|
||||||
cucumber-rails (= 0.3.2)
|
cucumber-rails (= 0.3.2)
|
||||||
database_cleaner (= 0.6.0)
|
database_cleaner (= 0.6.0)
|
||||||
devise (= 1.2.rc)
|
devise (= 1.1.3)
|
||||||
devise_invitable!
|
devise_invitable!
|
||||||
em-websocket!
|
em-websocket!
|
||||||
factory_girl_rails
|
factory_girl_rails
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,6 @@ class Invitation < ActiveRecord::Base
|
||||||
opts[:from].save!
|
opts[:from].save!
|
||||||
invitee.reload
|
invitee.reload
|
||||||
end
|
end
|
||||||
pp opts[:service]
|
|
||||||
pp opts[:service] == 'email'
|
|
||||||
invitee.invite!(:email => (opts[:service] == 'email'))
|
invitee.invite!(:email => (opts[:service] == 'email'))
|
||||||
Rails.logger.info("event=invitation_sent to=#{opts[:identifier]} #{"inviter=#{opts[:from].diaspora_handle}" if opts[:from]}")
|
Rails.logger.info("event=invitation_sent to=#{opts[:identifier]} #{"inviter=#{opts[:from].diaspora_handle}" if opts[:from]}")
|
||||||
invitee
|
invitee
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
class RemoveUniqueIndexOnEmailOnUsers < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
remove_index :users, :email
|
||||||
|
add_index :users, :email
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
remove_index :users, :email
|
||||||
|
add_index :users, :email, :unique => true
|
||||||
|
end
|
||||||
|
end
|
||||||
10
db/schema.rb
10
db/schema.rb
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20110126015407) do
|
ActiveRecord::Schema.define(:version => 20110126225202) do
|
||||||
|
|
||||||
create_table "aspect_memberships", :force => true do |t|
|
create_table "aspect_memberships", :force => true do |t|
|
||||||
t.integer "aspect_id"
|
t.integer "aspect_id"
|
||||||
|
|
@ -273,7 +273,8 @@ ActiveRecord::Schema.define(:version => 20110126015407) do
|
||||||
t.string "language"
|
t.string "language"
|
||||||
t.string "email", :default => "", :null => false
|
t.string "email", :default => "", :null => false
|
||||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
||||||
t.string "invitation_token", :limit => 60
|
t.string "password_salt", :default => "", :null => false
|
||||||
|
t.string "invitation_token", :limit => 20
|
||||||
t.datetime "invitation_sent_at"
|
t.datetime "invitation_sent_at"
|
||||||
t.string "reset_password_token"
|
t.string "reset_password_token"
|
||||||
t.string "remember_token"
|
t.string "remember_token"
|
||||||
|
|
@ -433,7 +434,8 @@ ActiveRecord::Schema.define(:version => 20110126015407) do
|
||||||
t.string "language"
|
t.string "language"
|
||||||
t.string "email", :default => "", :null => false
|
t.string "email", :default => "", :null => false
|
||||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
||||||
t.string "invitation_token", :limit => 60
|
t.string "password_salt", :default => "", :null => false
|
||||||
|
t.string "invitation_token", :limit => 20
|
||||||
t.datetime "invitation_sent_at"
|
t.datetime "invitation_sent_at"
|
||||||
t.string "reset_password_token"
|
t.string "reset_password_token"
|
||||||
t.string "remember_token"
|
t.string "remember_token"
|
||||||
|
|
@ -450,7 +452,7 @@ ActiveRecord::Schema.define(:version => 20110126015407) do
|
||||||
t.string "invitation_identifier"
|
t.string "invitation_identifier"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
add_index "users", ["email"], :name => "index_users_on_email"
|
||||||
add_index "users", ["invitation_token"], :name => "index_users_on_invitation_token"
|
add_index "users", ["invitation_token"], :name => "index_users_on_invitation_token"
|
||||||
add_index "users", ["mongo_id"], :name => "index_users_on_mongo_id"
|
add_index "users", ["mongo_id"], :name => "index_users_on_mongo_id"
|
||||||
add_index "users", ["username"], :name => "index_users_on_username", :unique => true
|
add_index "users", ["username"], :name => "index_users_on_username", :unique => true
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,6 @@ describe Invitation do
|
||||||
|
|
||||||
it 'mails the optional message' do
|
it 'mails the optional message' do
|
||||||
new_user = Invitation.create_invitee(@valid_params)
|
new_user = Invitation.create_invitee(@valid_params)
|
||||||
pp Devise.mailer.deliveries
|
|
||||||
Devise.mailer.deliveries.first.to_s.include?(@message).should be_true
|
Devise.mailer.deliveries.first.to_s.include?(@message).should be_true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -257,7 +256,11 @@ describe Invitation do
|
||||||
it 'does not save a user with an empty string email' do
|
it 'does not save a user with an empty string email' do
|
||||||
@valid_params[:service] = 'facebook'
|
@valid_params[:service] = 'facebook'
|
||||||
@valid_params[:identifier] = '3423423'
|
@valid_params[:identifier] = '3423423'
|
||||||
Invitation.create_invitee(@valid_params).email.should_not == ''
|
Invitation.create_invitee(@valid_params)
|
||||||
|
@valid_params[:identifier] = 'dfadsfdas'
|
||||||
|
lambda {
|
||||||
|
Invitation.create_invitee(@valid_params)
|
||||||
|
}.should_not raise_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue