Skip to content

Commit 25ee480

Browse files
committed
Change the email value, '', into "#{SecureRandom.uuid}@example.com"
- `"#{provider}-#{uid}@example.com"` breaks backward compatibility because in wiki it says `create_from_provider(provider)`: it doesn't pass uid. - `@example.com` makes it easy to check which email is valid or not
1 parent ff5c128 commit 25ee480

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/sorcery/model/submodules/external.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def create_from_provider(provider, uid, attrs)
6161

6262
# For external services that don't offer an email like twitter.
6363
unless attrs.has_key?(:email) && user.attributes.has_key?('email')
64-
user.send(:'email=', '')
64+
user.send(:'email=', "#{SecureRandom.uuid}@example.com")
6565
end
6666

6767
if block_given?

spec/shared_examples/user_shared_examples.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ def self.matches?(crypted, *tokens)
551551
User.create_from_provider('facebook', '123', username: 'Noam Ben Ari') { true }
552552
end.to change { User.count }.by(1)
553553

554-
expect(User.first.email).to eq ''
554+
expect(User.first.email).not_to be_empty
555555
end
556556
end
557557

0 commit comments

Comments
 (0)