bcgov / entity

ServiceBC Registry Team working on Legal Entities
Apache License 2.0
23 stars 57 forks source link

Account may change when navigating between UIs #6151

Closed severinbeauvais closed 2 years ago

severinbeauvais commented 3 years ago

NOTE: This will be needed when we start to see multiple accounts in PROD.

Describe the bug in current situation It was found that navigating from Auth Web -> Filings UI -> Create UI, the account name changed.

See steps to reproduce below.

Link bug to the User Story

Impact of this bug It may be possible for a user to create/file/pay an IA using the wrong account.

Chance of Occurring (high/medium/low/very low) Is reproducible.

Pre Conditions: which Env, any pre-requesites or assumptions to execute steps? Found in Dev.

Steps to Reproduce Steps to reproduce the behavior:

  1. Go to BCROS home page (https://dev.bcregistry.ca/business/auth/home/decide-business)
  2. Login as a user with multiple accounts (eg, bcreg2013)
  3. Switch to an account that is not the first in the list (eg, TESTaaaa)
  4. Click Business Registry title to return to home page
  5. Click Incorporate a Numbered Benefit Company -- you are now in Filings UI --
  6. Observe that account is unchanged (eg, Testaaaa)
  7. Click Incorporate a Numbered Company -- you are now in Create UI --
  8. Observe that account has changed (eg, tttttt)

Actual/ observed behavior/ results The account has changed.

Expected behavior The account remains the same as I previously selected

severinbeauvais commented 3 years ago

I set this to Priority 1 since this changes the user's account (which is not a good thing).

saravanpa-aot commented 3 years ago

@amit4610 @Milan-Freshworks please triage this

lmullane commented 3 years ago

Payment applied will not be applied to another account as this is managed by the payment API.

mstanton1 commented 3 years ago

This occurs because name request, entity dashboard, director search is using bcregistry.ca whereas create business and edit business are not. Because apps are in their own domains when a user logs in an selects account we save the account, yet when they switch we lose the saved value. Common components defaults to what is currently first in the list.

As noted by Loren payment is on the correct account.

To revisit once Openshift upgrade has taken place.

sienna-oldaccountdontuse commented 3 years ago

Let's wait a week for OCP stuff to be done, then test to see if this has been resolved.

mstanton1 commented 3 years ago

@severinbeauvais this appears to be resolved, presumably through the OCP migration.

Tested following your steps above (in TEST) using BCREG0009. In reproduction step 3 I chose New BC Online Tech Team from the account dropdown (2nd in the list). When I started the numbered company filing the appropriate account shows. Are you comfortable with me closing this?

image.png

severinbeauvais commented 3 years ago

Let me verify this. I will close if OK!

severinbeauvais commented 3 years ago

This problem reproduced easily just now when I followed the steps in the description (in Dev).

To summarize:

severinbeauvais commented 3 years ago

@severinbeauvais this appears to be resolved, presumably through the OCP migration.

Tested following your steps above (in TEST) using BCREG0009. In reproduction step 3 I chose New BC Online Tech Team from the account dropdown (2nd in the list). When I started the numbered company filing the appropriate account shows. Are you comfortable with me closing this?

You only went to step 6.

I tried it just now in Test using BCREG0009 and the problem reproduced (step 8).

image

mstanton1 commented 3 years ago

@severinbeauvais thank you for re-testing. We will leave this one open to tackle when time allows.

sienna-oldaccountdontuse commented 3 years ago

@severinbeauvais is this still an issue?

severinbeauvais commented 3 years ago

@mstanton1 is this still an issue?

mstanton1 commented 3 years ago

@severinbeauvais I have re-tested and this is still an issue.

@Sienna-Blumstengel perhaps we can work to prioritize some of the dependency work in BA guild this week.

sienna-oldaccountdontuse commented 3 years ago

This issue isn't super urgent, because the client can still pay with their correct account and payment method - the UI just displays the wrong account.

mstanton1 commented 2 years ago

Recent test of this with screenshots in 10814 (which has been closed as it is a duplicate). Note: this is becoming more urgent now because when the products and services don't reload a user will have a difficult time navigating to the appropriate service.

JohnamLane commented 2 years ago

Comment from @shabeeb-aot "Looks like this issue is happening due to different domains. home page bcregistry.ca and other one is bcregistry.daxiom.ca"

severinbeauvais commented 2 years ago

The BCROS UI calls await KeycloakService.initializeToken(null) to sync the session. Before this call, there is no KC token in session storage. After this call, it is populated in session storage. So I am not sure if "different domain" is really an issue...?

shabeeb-aot commented 2 years ago

Current account in stores in session. When user is changing account from https://test.bcregistry.ca/business/auth/home/decide-business domain it updated in current session storage. Screen Shot 2022-01-25 at 12 14 47 PM

when user move to home page, since domain changed it will call sync session , since there is no account in session storage, will set first account as current account in session storage. Need to do more research , just initial thoughts. May be we need to keep account id in URL or use iframe to set session storage across domains(not sure about security reasons). Screen Shot 2022-01-25 at 12 19 50 PM

severinbeauvais commented 2 years ago

OK, I see.

So this code will time out waiting for Current Account because it is not set in the current domain: https://github.com/bcgov/bcregistry/blob/157fdce8912e7e65ba6ae59f0dc879f62ab0cb62/pages/dashboard.vue#L91

What are the possible solutions?

shabeeb-aot commented 2 years ago

Easiest option will be using same domain for both :) Another solution is have to pass current account id in URL, while loading fetch and store in session. There are other options like setting inside iframe and sync with current domain (Never tried , just read about it). Also there may be some libraries

severinbeauvais commented 2 years ago

Faiz, assuming we won't get all apps in the same domain soon, what needs to be changed to pass the account id in the URL? Which URL? Could SbcSignin component provide account data (or another event) when ready? https://github.com/bcgov/bcregistry/blob/157fdce8912e7e65ba6ae59f0dc879f62ab0cb62/pages/signin.vue#L2

cc: @thorwolpert

pwei1018 commented 2 years ago

I think the easy way to fix this issue that we can remove the switch account options in the header menu. If the user want to using other account they can use breadcrumb go back to BCROS dashboard and switch it from there. If the user use bookmark or url access the app directly, we can redirect it back to BCROS dashboard if the session account doesn't have the product subscribed.

severinbeauvais commented 2 years ago

@pwei1018 I think that doesn't work correctly... Try this:

  1. go to https://yfthig-dev.web.app/
  2. login to BCSC "bcreg0020"
  3. in header, change to another account (eg, "MUltiple Business 1")
  4. observe that you have been redirected to https://dev.bcregistry.ca/business/auth/home/decide-business (you should stay on the BCROS page)
  5. observe that the account has not been changed (you are still on "resd")
  6. click breadcrumb to go back to BCROS
  7. observe that you are the new account; this is very confusing!
severinbeauvais commented 2 years ago

Please let all teams know if this fix has any impact in their apps.

rarya-freshworks commented 2 years ago

This is still an issue in test env as I can reproduce it following the steps very easily. Sending it back to dev @shabeeb-aot

severinbeauvais commented 2 years ago

Verification of this ticket requires #10880 to be completed as well.

rarya-freshworks commented 2 years ago

The scenario that is mentioned in description is not working. Another scenario which is not working is breadcrumbs. When navigating from breadcrumbs the account is getting switched which needs to be fixed as well.

Currently for testing I am verifying that account ID is showing in URL and when navigating to different UIs within relationships it stays the same.

For properly testing this ticket all the dependency tickets in 10880 needs to be merged together.

jyoti3286 commented 2 years ago

@rarya-freshworks - All the items related to this ticket have been developed. Can you proceed with the testing now and see if you still see that as an issue?

rarya-freshworks commented 2 years ago

I am using BCeID to test the scenario mentioned in the steps and it is having issue still. It works fine with BCSC login.

Note: Here is the recording with BCeID: https://images.zenhubusercontent.com/157936592/483df3fe-0838-422b-b7e8-046d1d7c1a99/recording.mov

saravanpa-aot commented 2 years ago

I am using BCeID to test the scenario mentioned in the steps and it is having issue still. It works fine with BCSC login.

Note: Here is the recording with BCeID: https://images.zenhubusercontent.com/157936592/483df3fe-0838-422b-b7e8-046d1d7c1a99/recording.mov

Can you try the same with PPR and Namex?

@shabeeb-aot any thoughts?

severinbeauvais commented 2 years ago

@shabeeb-aot What about auth-web code to add "accountid" to URL when redirecting to create a new numbered company?

jinghualicgi commented 2 years ago

Remove this ticket from SRE Jan28 Release, SRE didn't build this in PROD on January 28th

mstanton1 commented 2 years ago

@jinghualicgi your comment above mentions this wasn't built in PROD Jan 28th. Can you confirm if it's been released?

@PatrickAHeath has had a report from a client of this issue occurring again. We've located one bug (10996) but otherwise it looks like this shouldn't be an issue?

PatrickAHeath commented 2 years ago

Also, 10880 mentioned above is still in New Issues.