Skip to content

Commit

Permalink
Change the email value, '', into "#{SecureRandom.uuid}@example.com"
Browse files Browse the repository at this point in the history
- `"#{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
  • Loading branch information
ebihara99999 committed Dec 13, 2017
1 parent ff5c128 commit 25ee480
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/sorcery/model/submodules/external.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def create_from_provider(provider, uid, attrs)

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

if block_given?
Expand Down
2 changes: 1 addition & 1 deletion spec/shared_examples/user_shared_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def self.matches?(crypted, *tokens)
User.create_from_provider('facebook', '123', username: 'Noam Ben Ari') { true }
end.to change { User.count }.by(1)

expect(User.first.email).to eq ''
expect(User.first.email).not_to be_empty
end
end

Expand Down

0 comments on commit 25ee480

Please sign in to comment.