Skip to content

Commit

Permalink
demodulize added on authentication class name association name fetch (N…
Browse files Browse the repository at this point in the history
…oamB#147)

* demodulize added on authentication class name association name fetch

* changelog entry added for PR NoamB#147

* Add missing `#` to changelog entry
  • Loading branch information
hugogilmar authored and joshbuker committed Sep 20, 2018
1 parent eea7a1c commit 12ccd64
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Add support for VK OAuth (thanks to @Hirurg103) [#109](https://github.com/Sorcery/sorcery/pull/109)
* Fix token leak via referrer header [#56](https://github.com/Sorcery/sorcery/pull/56)
* Add `login_user` helper for request specs [#57](https://github.com/Sorcery/sorcery/pull/57)
* Added `demodulize` on authentication class name association name fetch [#147](https://github.com/Sorcery/sorcery/pull/147)

## 0.11.0

Expand Down
4 changes: 2 additions & 2 deletions lib/sorcery/model/submodules/external.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def load_from_provider(provider, uid)

def create_and_validate_from_provider(provider, uid, attrs)
user = new(attrs)
user.send(sorcery_config.authentications_class.to_s.downcase.pluralize).build(
user.send(sorcery_config.authentications_class.name.demodulize.underscore.pluralize).build(
sorcery_config.provider_uid_attribute_name => uid,
sorcery_config.provider_attribute_name => provider
)
Expand Down Expand Up @@ -92,7 +92,7 @@ def build_from_provider(attrs)

module InstanceMethods
def add_provider_to_user(provider, uid)
authentications = sorcery_config.authentications_class.name.underscore.pluralize
authentications = sorcery_config.authentications_class.name.demodulize.underscore.pluralize
# first check to see if user has a particular authentication already
if sorcery_adapter.find_authentication_by_oauth_credentials(authentications, provider, uid).nil?
user = send(authentications).build(sorcery_config.provider_uid_attribute_name => uid,
Expand Down

0 comments on commit 12ccd64

Please sign in to comment.