Conversation
|
supersedes: #4399 |
|
So great, @everreau! I've suggested some changes in line with ORCID's brand guidelines This is only for journals at the moment, is that correct? Could the co-author use the ORCID login option to connect their iD to their account rather than connecting the iD in their profile? What happens if the co-author is a frozen author without an account, or if the account isn't active? |
|
@alainna. All of the login features also work for preprints. I don't see any reference at all to orcids in the preprint author interface. I think we (cdl) would send whatever orcid was in the author's account to crossref even though it's not visible and it appears in the preprint front end. The profile and the account are the same as far as I know. The interface on main is a bit different than what we're currently running. Maybe we should setup a time so you can take a look at what I have. I hadn't really thought about what would happen if a user connects their orcid after the frozen authors were already made. I'll take a look at that. |
On the |
|
@joemull can you do the first technical review on this and then pass it to me please? |
|
Just an update: I should be able to get to this |
|
Some suggestions for this dev: eScholarship#46 |
joemull
left a comment
There was a problem hiding this comment.
This is hugely appreciated--thank you for putting it in.
I'm having trouble testing it out (an issue with OLH's ORCID sandbox that will take a few days to resolve), but I've gone ahead and given you some comments from reading the code. Hope they're clear but please do ping me if anything does not make sense.
| response = self.client.get(reverse("core_edit_profile")) | ||
| self.assertContains(response, "ORCID iD could not be validated.") | ||
| self.assertContains(response, "Connect your ORCID") | ||
| self.assertContains(response, "https://sandbox.orcid.org/0000-0000-0000-0000") |
There was a problem hiding this comment.
Does this test (or any of the ones below) rely on a network connection? We'll need to put mocks into any test that relies on a network connection.
| response, '<input type="text" name="orcid" maxlength="40" id="id_orcid">' | ||
| ) | ||
|
|
||
| def test_profile_orcid_enabled_no_orcid(self): |
There was a problem hiding this comment.
Maybe add an override_settings decorator on this and other tests that expect ENABLE_ORCID=True, in case someone has it off and runs tests.
| orcid = models.CharField( | ||
| max_length=40, null=True, blank=True, verbose_name=_("ORCiD") | ||
| ) | ||
| orcid_token = models.CharField(max_length=40, null=True, blank=True) |
There was a problem hiding this comment.
Charfields should not have null=True
| expiry = models.DateTimeField( | ||
| default=generate_expiry_date, verbose_name=_("Expires on") | ||
| ) | ||
| access_token = models.CharField(max_length=40, null=True, blank=True) |
There was a problem hiding this comment.
Same as the other one--charfields should not have null=True
| messages.SUCCESS, | ||
| _("Your ORCID has been connected to your account."), | ||
| ) | ||
| return redirect(logic.reverse_with_next("core_edit_profile", next_url)) |
There was a problem hiding this comment.
Haven't been able to test this yet but I'm actually having trouble working out what's happening just by reading it, especially the case where they're not authenticated and they get sent to a different login screen. Can you add a comment above with context, like the other if / else branches have?
| <tr> | ||
| <th>{% trans 'Name' %}</th> | ||
| <th>{% trans 'Email' %}</th> | ||
| <th>{% trans 'ORCID' %}</th> |
| "type": "rich-text" | ||
| }, | ||
| "value": { | ||
| "default": "<p>Dear {{ user.full_name }}<br/><br/>Your co-author has requested your ORCID iD. You can add it by through your profile {{ user_profile_url }}.<br/></p>" |
| "editor", | ||
| "journal-manager" | ||
| ] | ||
| }, |
There was a problem hiding this comment.
It looks like this separate template isn't needed, since the email text is the same and the link is the same. Only the subject differs. Is there another reason for it?
| def is_token_valid(orcid_id, token): | ||
| api_client = OrcidAPI( | ||
| settings.ORCID_CLIENT_ID, settings.ORCID_CLIENT_SECRET, sandbox=True | ||
| ) |
There was a problem hiding this comment.
The sandbox parameter needs to be able to change in production. Maybe it should be based on whether sandbox.orcid.org is present in the URL in settings.py?
| logger.info("Retrieving ORCID profile for %s", orcid) | ||
| api_client = OrcidAPI(settings.ORCID_CLIENT_ID, settings.ORCID_CLIENT_SECRET) | ||
| api_client = OrcidAPI( | ||
| settings.ORCID_CLIENT_ID, settings.ORCID_CLIENT_SECRET, sandbox=True |
There was a problem hiding this comment.
Same comment about changing sandbox in production.
Addresses: #2610
When orcid is enabled: