Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORCiD info is prefilled when registering #4279

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

everreau
Copy link
Contributor

@everreau everreau commented Jun 14, 2024

Closes #3337.

  • Add functionality to prefill registration field from orcid info
  • Allow user to prefill form from orcid but remove orcid (for some reason, it was in the spec from Alainna)
  • Display orcid to their display standards
  • Test it.

@Bbkctp
Copy link
Contributor

Bbkctp commented Jun 14, 2024

Can one of the admins verify this patch?

@ajrbyers
Copy link
Member

Jenkins: Whitelist

@ajrbyers
Copy link
Member

Jenkins: test this please

@alainna
Copy link
Contributor

alainna commented Jun 20, 2024

related: #3337

@alainna
Copy link
Contributor

alainna commented Jun 20, 2024

@everreau @ajrbyers The rationale for allowing the user to remove the ORCID iD from the registration form (or their profile) is in case they authenticate the incorrect ORCID iD. This can occur when the user:

a. accidentally registers a new ORCID iD;
b. has multiple ORCID iDs (for whatever reason) and uses the incorrect one;
c. is a delegate to another ORCID user and has connected their delegator's ORCID iD.

(My expectation would be that with the ORCID iD is removed, the access token is simultaneously revoked also. haven't checked whether that's part of the process.)

@alainna
Copy link
Contributor

alainna commented Jun 20, 2024

@everreau the display of the ORCID iD should be HTTPS, not HTTP

@ajrbyers
Copy link
Member

For clarification it allows the user to remove the ORCID but doesn’t remove it automatically?

@everreau
Copy link
Contributor Author

@alainna 1. hm.. if that's the use case for the remove orcid link I can probably just make it simpler. This remove the orcid removes the id but keeps the form auto-filled. (This seemed unnecessarily complicated to me but that was how I interpreted the spec). If it's just for the case that it's the wrong orcid we could just link back to the original form with no token.
2. I don't know where you're refering to HTTP v HTTPS There is some http in the tests but that's not really related to what will show in real life. In the real implementation it grabs the orcid url from the orcid response.

@alainna
Copy link
Contributor

alainna commented Jun 25, 2024

@everreau
1: I think that the form should also remain auto-filled after removing the ORCID iD and revoking the access token -- it seems the simplest method. But maybe there should be an open to "clear form" so the user could start over? Maybe as a question modal/box "do you also want to clear the form"?

2: excellent!!

@everreau
Copy link
Contributor Author

@alainna Leaving the form auto-filled is not simpler and it seems like a weird thing to do. "I want to use my orcid data to fill the form but I do NOT want to save that orcid". However, I already implemented this functionality so I can leave it as-is. I was just asking to make it simpler. If we don't simplify it then they can just click the "Register" link again to get a clean form.

@joemull joemull self-requested a review July 9, 2024 08:58
@joemull joemull assigned joemull and unassigned ajrbyers Jul 9, 2024
@joemull joemull removed the request for review from ajrbyers July 9, 2024 08:58
Copy link
Member

@joemull joemull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @everreau--I think this is good but it is pulling on some pre-existing spaghetti we have around URL formation and carrying users through redirects that I think we need to address a bit more holistically. I happen to be working on another feature that touches the same code, so I am sharing some information related to that below. See comments inline.

As for the feature to remove the ORCID, I think we should take the additional context from Alainna and simplify it like you suggest. I think it would be counter-intuitive to offer just the deletion of the ORCID, without removing the rest of the form details, because the user will wonder what they are actually doing when they submit the form after that. Are they still connecting their orcid account? Maybe some kind of "Start over" or "Retry" button would be clearer?

elif request.journal:
return redirect(reverse('core_dashboard'))
else:
return redirect(reverse('website_index'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit has one too many indents.

@@ -328,8 +342,6 @@ def register(request):
if form.is_valid():
if token_obj:
new_user = form.save(commit=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be commit=True or no commit arg if the user is not being saved because line 332 is deleted.

press= helpers.create_press()
repo = helpers.create_repository(press, [], [])
self.assertEqual(build_redirect_uri(repo), "http://localhost/login/orcid/?action=login")
self.assertEqual(build_redirect_uri(repo, action="register"), "http://localhost/login/orcid/?action=register")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing for me because it's missing some data around the request. But once that data is provided and the function runs, I think it will still not be a great idea to pass query parameters in the path argument of site_url and build_url functions. I understand why you are putting it in the path and not a query dict or something, because we don't provide a way to pass query parameters into that function and even if you could, the URL encoding is redundant so the URL would be garbled on its way back from ORCiD.

I discovered these things while working on a separate feature, #3899, whereby users will be carried through the login and registration process with a bit more care. It's still a work in progress but I'm thinking of expanding simplifying and unifying our token models so that we can retrieve next URLs and query parameters like this, even when we send things out to ORCiD.

If we were to fix up the tokens, we could make use of ORCiD's state parameter, which would let us link up the appropriate "next" url, whether login or registration (your feature) or something else (my feature).

I know this is a lot but I am curious what your thoughts are. If you want to glance over my still-messy WIP, it's here: #4322

@@ -44,6 +44,7 @@ def retrieve_tokens(authorization_code, site):
try:
r.raise_for_status()
except HTTPError as e:
print(e)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should remove this right?

@joemull joemull changed the title 3337 orcid prefill ORCiD info is prefilled when registering Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow users to prefill registration form with ORCID record data
5 participants