Add Facebook login with Sorcery

The facebook key and secret defined in the sorcery config file are for
testing only and need to be changed and not committed to source when
app is ready to go live
This commit is contained in:
Graham Kaplan
2014-04-05 19:18:57 -07:00
parent a6da30dc08
commit 230295790b
17 changed files with 112 additions and 12 deletions
+3
View File
@@ -0,0 +1,3 @@
class Authentication < ActiveRecord::Base
belongs_to :user
end
+5 -1
View File
@@ -1,5 +1,7 @@
class User < ActiveRecord::Base
authenticates_with_sorcery!
authenticates_with_sorcery! do |config|
config.authentications_class = Authentication
end
validates :password, presence: true, confirmation: true, length: { minimum: 3 }, unless: ("id?" || "password_confirmation?")
validates :password_confirmation, presence: true, unless: ("id?" || "password?")
@@ -16,5 +18,7 @@ class User < ActiveRecord::Base
has_many :user_organization_relationships
has_many :organizations, through: :user_organization_relationships
has_many :authentications, :dependent => :destroy
accepts_nested_attributes_for :authentications
end