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

Feat/backend/limit login to one mobile device #367

Merged
merged 9 commits into from
Sep 22, 2024

Conversation

waveyboym
Copy link
Member

@waveyboym waveyboym commented Sep 22, 2024

Description

This pr attempts to introduce a feature whereby logging in and maintaining active sessions on more than one mobile device will now be impossible. Needs further review and feedback from @KamogeloMoeketse

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Various unit and integration tests were written hopefully increasing coverage and bringing the total up to 917 total tests for the backend

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Add mobile user to cache during login and logout

- Added a new function AddMobileUser to auth_helpers.go to add a mobile user to the cache during login.
- Modified Login, VerifyOTP, and ResetPassword functions in auth_handlers.go to call AddMobileUser.
- Modified Logout function in auth_handlers.go to remove the mobile user from the cache.
- Modified router.go to pass the appsession to the Logout function.

Related to #issue_number
@waveyboym waveyboym added type: security This is a security related issue/pr type: testing This affects one or more tests For: api This is mainly for the api For: backend This is mainly for the backend code priority: high This needs/needed to be addressed as soon as possible effort: 5 This may require/required hours of work labels Sep 22, 2024
@waveyboym waveyboym self-assigned this Sep 22, 2024
Copy link

codecov bot commented Sep 22, 2024

Codecov Report

Attention: Patch coverage is 93.10345% with 6 lines in your changes missing coverage. Please review.

Project coverage is 94.24%. Comparing base (f1c0587) to head (89302de).
Report is 10 commits behind head on develop.

Files with missing lines Patch % Lines
occupi-backend/pkg/cache/cache.go 81.25% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop     #367       +/-   ##
============================================
+ Coverage    69.23%   94.24%   +25.01%     
============================================
  Files           55       11       -44     
  Lines         6143     3407     -2736     
  Branches        84        0       -84     
============================================
- Hits          4253     3211     -1042     
+ Misses        1833      147     -1686     
+ Partials        57       49        -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@waveyboym waveyboym merged commit 6a3a484 into develop Sep 22, 2024
7 checks passed
@waveyboym waveyboym deleted the feat/backend/limit-login-to-one-mobile-device branch September 22, 2024 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: 5 This may require/required hours of work For: api This is mainly for the api For: backend This is mainly for the backend code priority: high This needs/needed to be addressed as soon as possible type: security This is a security related issue/pr type: testing This affects one or more tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant