Skip to content

Commit

Permalink
Fix social-app-django/issues/355
Browse files Browse the repository at this point in the history
Handle the case where the user has not registered a `family-name` and
ORCID returns `None`.
  • Loading branch information
nikoder committed May 15, 2024
1 parent 2c53cb1 commit db50523
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Changed
- Handle case where user has not registered a `family-name` with ORCID

## [4.5.4](https://github.com/python-social-auth/social-core/releases/tag/4.5.4) - 2024-04-25

### Added
Expand Down
3 changes: 2 additions & 1 deletion social_core/backends/orcid.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def get_user_details(self, response):

if name:
first_name = name.get("given-names", {}).get("value", "")
last_name = name.get("family-name", {}).get("value", "")
if name.get("family-name", None) is not None:
last_name = name.get("family-name").get("value", "")

emails = person.get("emails")
if emails:
Expand Down

0 comments on commit db50523

Please sign in to comment.