Permalink
Browse files

Skip user_class validations when create it from provider

  • Loading branch information...
1 parent 90e12dc commit 496d68a7cade4d6c63fe88745b0590a9ce02ecbf @willywg committed Sep 23, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/sorcery/controller/submodules/external.rb
@@ -63,6 +63,7 @@ def login_from(provider)
# {:username => "user/name"}
#
# And this will cause 'moishe' to be set as the value of :username field.
+ # Note: Be careful. This method skips validations model.
def create_from(provider)
provider = provider.to_sym
@provider = Config.send(provider)
@@ -78,7 +79,8 @@ def create_from(provider)
end
end
user_class.transaction do
- @user = user_class.create!(attrs)
+ @user = user_class.new(attrs)
+ @user.save(:validate => false)
user_class.sorcery_config.authentications_class.create!({config.authentications_user_id_attribute_name => @user.id, config.provider_attribute_name => provider, config.provider_uid_attribute_name => @user_hash[:uid]})
end
@user

0 comments on commit 496d68a

Please sign in to comment.