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

Support login for multiple users #2779

Draft
wants to merge 40 commits into
base: main
Choose a base branch
from
Draft

Support login for multiple users #2779

wants to merge 40 commits into from

Conversation

LZRS
Copy link
Contributor

@LZRS LZRS commented Sep 22, 2023

IMPORTANT: Where possible all PRs must be linked to a Github issue

Fixes #2330

Engineer Checklist

  • I have written Unit tests for any new feature(s) and edge cases for bug fixes
  • I have added any strings visible on UI components to the strings.xml file
  • I have updated the CHANGELOG.md file for any notable changes to the codebase
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the project's style guide
  • I have built and run the FHIRCore app to verify my change fixes the issue and/or does not break the app
  • I have checked that this PR does NOT introduce breaking changes that require an update to Content and/or Configs? If it does add a sample here or a link to exactly what changes need to be made to the content.

Code Reviewer Checklist

  • I have verified Unit tests have been written for any new feature(s) and edge cases
  • I have verified any strings visible on UI components are in the strings.xml file
  • I have verifed the CHANGELOG.md file has any notable changes to the codebase
  • I have verified the solution has been implemented in a configurable and generic way for reuseable components
  • I have built and run the FHIRCore app to verify the change fixes the issue and/or does not break the app

@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Attention: Patch coverage is 64.64646% with 35 lines in your changes missing coverage. Please review.

Project coverage is 27.5%. Comparing base (2f8055b) to head (390cffe).

Files with missing lines Patch % Lines
...re/engine/data/remote/shared/TokenAuthenticator.kt 40.4% 17 Missing and 8 partials ⚠️
...ter/fhircore/engine/util/SecureSharedPreference.kt 88.6% 5 Missing ⚠️
...er/fhircore/engine/util/SharedPreferencesHelper.kt 62.5% 3 Missing ⚠️
...gister/fhircore/engine/rulesengine/RulesFactory.kt 0.0% 0 Missing and 1 partial ⚠️
...gister/fhircore/engine/util/SharedPreferenceKey.kt 75.0% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main   #2779     +/-   ##
=========================================
+ Coverage     27.2%   27.5%   +0.3%     
- Complexity     749     760     +11     
=========================================
  Files          275     275             
  Lines        13940   13919     -21     
  Branches      2532    2514     -18     
=========================================
+ Hits          3794    3837     +43     
+ Misses        9622    9556     -66     
- Partials       524     526      +2     
Flag Coverage Δ
engine 64.3% <64.6%> (-0.1%) ⬇️
geowidget 12.5% <ø> (ø)

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

Files with missing lines Coverage Δ
...egister/fhircore/quest/ui/login/LoginErrorState.kt 100.0% <ø> (ø)
...artregister/fhircore/quest/ui/login/LoginScreen.kt 0.0% <ø> (ø)
...register/fhircore/quest/ui/login/LoginViewModel.kt 1.3% <ø> (-0.4%) ⬇️
...egister/fhircore/quest/ui/main/AppMainViewModel.kt 3.4% <ø> (+<0.1%) ⬆️
...rtregister/fhircore/quest/ui/pin/PinLoginScreen.kt 0.0% <ø> (ø)
.../smartregister/fhircore/quest/ui/pin/PinUiState.kt 100.0% <ø> (ø)
...martregister/fhircore/quest/ui/pin/PinViewModel.kt 4.4% <ø> (-1.2%) ⬇️
...e/quest/ui/questionnaire/QuestionnaireViewModel.kt 2.5% <ø> (-0.4%) ⬇️
...gister/fhircore/engine/rulesengine/RulesFactory.kt 66.2% <0.0%> (-0.7%) ⬇️
...gister/fhircore/engine/util/SharedPreferenceKey.kt 95.2% <75.0%> (-4.8%) ⬇️
... and 3 more

@@ -29,7 +29,7 @@ data class ApplicationConfiguration(
val languages: List<String> = listOf("en"),
val useDarkTheme: Boolean = false,
val syncInterval: Long = 15,
val syncStrategies: List<String> = listOf(),
val syncStrategy: List<String> = listOf(),
Copy link
Member

Choose a reason for hiding this comment

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

since this is a list I think as is as a plural makes sense

Comment on lines 100 to 102
if (value is PractitionerDetails) {
Timber.e(it)
}
Copy link
Member

Choose a reason for hiding this comment

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

guessing this is temporary for debugging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it's just for debugging

@LZRS LZRS force-pushed the support-multi-user-login branch from 9be6b93 to e121c22 Compare September 22, 2023 14:52
@LZRS LZRS force-pushed the support-multi-user-login branch from caffff1 to ac7c05f Compare September 29, 2023 13:37
@ellykits ellykits added Discussion This is an open discussion that may or may not lead to actionable points Work In Progress Describes an items that is not complete. Mostly used for scoping issues of discussions labels Oct 11, 2023
@LZRS LZRS force-pushed the support-multi-user-login branch from 8dafdc7 to 4413416 Compare October 27, 2023 13:53
@pld
Copy link
Member

pld commented Oct 27, 2023

@LZRS is this ready for review?

@LZRS
Copy link
Contributor Author

LZRS commented Oct 27, 2023

@LZRS is this ready for review?

It can be reviewed but there are still some code changes pending, as we look to consult further (with tpms) on how/what user roles to check for and also update tests

@LZRS
Copy link
Contributor Author

LZRS commented Nov 24, 2023

Currently, only supporting multiple user logins when online. Will be adding support for offline as well in subsequent sessions, as we continue to discuss on how to effectively handle the pin login usecase

@LZRS LZRS force-pushed the support-multi-user-login branch from 74fea1b to 81e8fb2 Compare March 1, 2024 13:16
@LZRS LZRS force-pushed the support-multi-user-login branch from 81e8fb2 to 39ac63e Compare March 8, 2024 14:45
@LZRS LZRS force-pushed the support-multi-user-login branch from 39ac63e to 6a6904a Compare March 15, 2024 14:35
@LZRS LZRS force-pushed the support-multi-user-login branch from 8e67b8c to a029ab6 Compare June 14, 2024 12:55
@pld
Copy link
Member

pld commented Jun 14, 2024

@LZRS this ready for review?

@LZRS
Copy link
Contributor Author

LZRS commented Jun 14, 2024

@LZRS this ready for review?

Yeah, it's ready for an initial review although we're still deliberating on how to go about pin login. For the suggested workflows of logging out and logging in to change user, and allowing selection of user from dropdown from pin login page, we're still not certain how to handle/support a user resetting their pin

@LZRS
Copy link
Contributor Author

LZRS commented Jul 12, 2024

Is it a requirement to support switching of users using pin login instead of the normal login? Also on the same, will we need to support users resetting the pins by going back to the login page and re-entering password? @ndegwamartin @dubdabasoduba

@LZRS
Copy link
Contributor Author

LZRS commented Jul 23, 2024

Is it a requirement to support switching of users using pin login instead of the normal login? Also on the same, will we need to support users resetting the pins by going back to the login page and re-entering password? @ndegwamartin @dubdabasoduba

Had a discussion on this and agreed on allowing user to continue using navigation back to login to reset a their pin and also support dropdown selection in pin login screen for switching between users when offline (Users in the dropdown are to be listed through their names instead of usernames, for some security).
Next steps will be to follow up with design team to see how best to go about the pin login dropdown and how it should look

@LZRS LZRS force-pushed the support-multi-user-login branch from 232f6e5 to d6948aa Compare July 26, 2024 13:56
@Rkareko
Copy link
Contributor

Rkareko commented Aug 22, 2024

@HenryRae cc @rowo Concerning login for multiple users there is need for user selection when performing login using a PIN. We are seeking your guidance on the UI for the user selection widget in the Pin Login screen. As shown above it has been implemented as a drop down menu. Is this sufficient? Could you provide mock ups for how best to implement this.

@HenryRae
Copy link

@Rkareko my concern with this approach is:

When user logs out, ideally they should only be able to access the app when they log back in the app using username & password. Not with just PIN
PIN login was for quick asses to the app on a device. And gets displayed when one minimises the app for x-minutes, or exits the app.vThus if one logs out, and logs back into the app with just PIN, raises security concerns (where they really logged out).

Proposal: We could change login with password to login with PIN. That way, when one logs out, and reselects their username from the list, they just enter PIN.
Alternative(the better solution): We have a CTA in the dropdown list which allows one to add multiple users. Anyone who logs out of the app, isn't shown in the list. Whoever logs in and only exits that app without logging out, will still be able to access their account with just PIN.

Cc: @rowo @LZRS @DebbieArita

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion This is an open discussion that may or may not lead to actionable points Work In Progress Describes an items that is not complete. Mostly used for scoping issues of discussions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support logging in multiple users (of the same team) when online
7 participants