NoamB/sorcery — pull request #283 by grrrisu (2012-05-07 21:12:35+00:00)
Title: create_from provider with block

As create from provider doesn't perform any validation, it would be useful to a have a possibility to check the user model before it is saved.

I extended **create_from** with a block variant. The user with all user mapping is passed to the block. If the block returns true it will be created otherwise not.

````ruby
@user = create_from(provider) do |user|
user.check_for_some_validations
end
````
I needed this for my application, where the username is unique. Independent if the users register creating their own passwords or use a provider. Otherwise it would be still possible to have two users with the same username, one with a password the other one with a provider authentication.