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

🐛 Fixes registration in multiple products via invitations #5055

Merged
merged 34 commits into from
Jan 6, 2024

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Nov 20, 2023

What do these changes do?

  • 🐛A registered user gets an invitation to register in another product of the same deploy. This PR fixes a check upon registration that would not allow it
  • 🐛 Fixes invitation guest email check to non-sensitive ( @eofli found a case of a user that was invited with upper-case email)
  • ♻️some refactoring of login plugin (our plan is to split this further in coming PRs)

Related issue/s

How to test

  • Driving test pytest -vv -k test_registration_to_different_product --pdb tests/unit
  • Manual exploratory testing (FYI @elisabettai 🚨)
    • Use workflow 1: register same user in two products
      • a registered user in product A
      • create an invitation for product B
      • gets added to product B
    • User workflow 2: fail to register same user in same product
      • a registered user in product A
      • create an invitation for product A
      • fails with invitation is already used
    • User workflow 3: fail to register BANNED user
    • a registered user in product A is set to BANNED
    • create invitation for product C
    • should fail

Dev Checklist

DevOps Checklist

@pcrespov pcrespov added the a:webserver issue related to the webserver service label Nov 20, 2023
@pcrespov pcrespov self-assigned this Nov 20, 2023
@pcrespov pcrespov force-pushed the fix-product-registration branch from 1c44919 to fa1a06e Compare November 20, 2023 22:34
Copy link

codeclimate bot commented Nov 20, 2023

Code Climate has analyzed commit fa1a06e and detected 0 issues on this pull request.

View more on Code Climate.

Copy link

sonarcloud bot commented Nov 20, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.4% 0.4% Duplication

Copy link

codecov bot commented Nov 20, 2023

Codecov Report

Attention: 15 lines in your changes are missing coverage. Please review.

Comparison is base (b429614) 87.3% compared to head (8aab3b8) 88.2%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #5055     +/-   ##
========================================
+ Coverage    87.3%   88.2%   +0.9%     
========================================
  Files        1292    1145    -147     
  Lines       52984   47997   -4987     
  Branches     1160    1114     -46     
========================================
- Hits        46272   42369   -3903     
+ Misses       6462    5387   -1075     
+ Partials      250     241      -9     
Flag Coverage Δ
integrationtests 65.0% <28.5%> (+<0.1%) ⬆️
unittests 86.6% <66.6%> (+1.5%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...se/src/simcore_postgres_database/utils_products.py 100.0% <100.0%> (ø)
...rc/simcore_service_invitations/api/_invitations.py 100.0% <ø> (ø)
...invitations/src/simcore_service_invitations/cli.py 92.1% <ø> (ø)
...imcore_service_invitations/services/invitations.py 97.1% <100.0%> (ø)
...server/src/simcore_service_webserver/groups/_db.py 94.9% <100.0%> (+0.1%) ⬆️
...src/simcore_service_webserver/invitations/_core.py 77.6% <100.0%> (+1.6%) ⬆️
.../src/simcore_service_webserver/login/_constants.py 100.0% <100.0%> (ø)
...e_service_webserver/login/handlers_registration.py 90.5% <100.0%> (+0.7%) ⬆️
...server/src/simcore_service_webserver/groups/api.py 93.8% <50.0%> (-2.8%) ⬇️
...c/simcore_service_webserver/login/_registration.py 78.2% <52.1%> (+3.2%) ⬆️

... and 167 files with indirect coverage changes

@pcrespov pcrespov force-pushed the fix-product-registration branch 3 times, most recently from 9690f50 to bb609a3 Compare January 3, 2024 19:35
@pcrespov pcrespov added this to the Kobayashi Maru milestone Jan 4, 2024
@pcrespov pcrespov force-pushed the fix-product-registration branch from 5852b72 to de40e01 Compare January 4, 2024 13:43
@pcrespov pcrespov changed the title WIP: Fix product registration 🐛 Fixes product registration Jan 4, 2024
@pcrespov pcrespov changed the title 🐛 Fixes product registration 🐛 Fixes registration in multiple products Jan 4, 2024
@pcrespov pcrespov changed the title 🐛 Fixes registration in multiple products 🐛 Fixes registration in multiple products Jan 4, 2024
@pcrespov pcrespov marked this pull request as ready for review January 4, 2024 15:53
@pcrespov pcrespov changed the title 🐛 Fixes registration in multiple products 🐛 Fixes registration in multiple products via invitations Jan 4, 2024
@pcrespov pcrespov enabled auto-merge (squash) January 4, 2024 19:19
Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

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

Looking good. Have just a few concerns.

Copy link
Contributor

@matusdrobuliak66 matusdrobuliak66 left a comment

Choose a reason for hiding this comment

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

Looking good, thanks!

Copy link
Contributor

@bisgaard-itis bisgaard-itis left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks for the effort!

@pcrespov pcrespov force-pushed the fix-product-registration branch from 91ddcd5 to 29be72b Compare January 5, 2024 10:13
@pcrespov pcrespov requested a review from GitHK January 5, 2024 10:13
Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

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

Thanks for the feedback

Copy link

sonarcloud bot commented Jan 5, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@pcrespov pcrespov disabled auto-merge January 6, 2024 02:24
@pcrespov pcrespov enabled auto-merge (squash) January 6, 2024 02:25
@pcrespov pcrespov disabled auto-merge January 6, 2024 02:25
@pcrespov pcrespov merged commit 87a98f1 into ITISFoundation:master Jan 6, 2024
54 checks passed
@pcrespov pcrespov deleted the fix-product-registration branch January 6, 2024 02:25
@elisabettai
Copy link
Collaborator

Hi @pcrespov, I tested a bit.

Workflow 1 works as expected (register same user in two products). ✔️

Workflow 2 (fail to register same user in same product ) works as expected. ✔️

Workflow 3 (try to register banned use works) works as expected. ✔️

I also tried a workflow different from the 3 suggested above. 😈

Workflow 4:

  • User A has state "CONFIRMATION_PENDING", forgot that he already requested an account with email A, asks another one
  • PO generates an invitation for email A
  • User A enters again his password 2 times
  • User sees this error:
    image
    POST request to "https://s4l-master.speag.com/v0/auth/register" gives a 500

Some improvements (for the future), more or less related to this PR, sorry for bringing this up here ☺️ :

  • From POs' perspective: Issue error/warning when POs generate invitations that cannot be consumed (e.g. if the email is already registered, if user is banned). I like that if a PO tries to create an invitation for a product that doesn't require invitations, it generates an error as soon as the PO tries to create an invitation. I would re-use this behavior as much as possible.
  • From users' perspective: issue an error when user asks to reset password, but the user hasn't registered yet (it was reported by sim4life.io testers here)
  • Found a small frontend bug: PO center, "Copy invitation link" is invisible until you hover osparc-issues#1223

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:webserver issue related to the webserver service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants