hicommonwealth / commonwealth

A platform for decentralized communities
https://commonwealth.im
GNU General Public License v3.0
67 stars 42 forks source link

[Bug]: When signing in, im constantly prompted to add a username (despite already having one) #8645

Closed commonwealth-issue-bot[bot] closed 1 month ago

commonwealth-issue-bot[bot] commented 1 month ago

Description

"Oliver Armitage, [7/27/24 8:39 AM] Hey Mark I'm having a login issue with Common that I know at least one other user in my community is having. Everytime I go to the page it throws me the popup window "select a username", but then wont let me write my existing username as it says "username already exists". I have a workaronud where everytime I open common I generate a random username but then go inot my account and change it back to my username. However this is annoying. ANy idea whats going on?

Oliver Armitage, [7/27/24 8:42 AM] I've had this every time ive tried to login to common since my community switched over to it 2 weeks ago

Oliver Armitage, [7/27/24 2:00 PM] this is the pop up i get each time i reopen the website (see attached screenshot)

Oliver Armitage, [7/27/24 2:00 PM] you can see in the background that my user profile is logged in and that my email address is connected

https://commonwealth.im/profile/id/154523 https://commonwealth.im/vita-fast/discussions

Internal Reporter (Growth Team)

Mark

Communities Affeceted

VitaFast - possibly others

Initial Conditions

Environment: Prod Encounter Date/Time: Friday

Reproduction Steps

figuring that our rn

Expected Behavior

You should just login without the prompt every single time

Videos / Screenshots

https://drive.google.com/open?id=14z1-9f2Qy4-GCyPi_vj8WiXWjc01tMP4

Additional Information

could be wide spread

timolegros commented 1 month ago

I think I found the issue. It seems that this user, and likely many others, have only a single address in the community in which they signed in and no default address (membership) in the Ethereum community. This causes an issue because when signing we query for the user's address + profile (/getAddressProfile) but filter by the ethereum community. This means no profile is returned and the user is not recognized on the client even though the user has signed in before.

To resolve this we likely need to remove the 'community_ids' search parameter when signing in so that any matching address is valid.

timolegros commented 1 month ago

@mzparacha the issue I described above only resolves an account recognition issue and seems to be a separate bug. Once the above is fixed I still get the modal asking for a username.

Pinging @Rotorsoft since this seems to be a profile-related issue.

mzparacha commented 1 month ago

I tried with a cosmos/ethereum community, not able to repro with these steps

- go to any cosmos/ethereum community, authenticate
- logout
- go to home page, login with same account
- notice issue with account username

but I did notice a different issue "signing with existing account on dashboard redirects through the new signup flow - but at the end the logged-in account is same" (that is a probably different issue).

https://github.com/user-attachments/assets/cbb058be-0d4f-472b-b133-d03398dcdeba

cc: @timolegros

timolegros commented 1 month ago

I tried with a cosmos/ethereum community, not able to repro with these steps

For visibility, I reproduced by locally mocking the user:

UPDATE "Addresses"
SET address = '[your address]'
WHERE address = '0xFcA51ed3FdDe1c66Ed5c37f5C048cCBc9049Ed66';
mzparacha commented 1 month ago

For visibility, I reproduced by locally mocking the user:

Not able to reproduce with this approach as well (plz lmk if I did it incorrectly)

https://github.com/user-attachments/assets/656b6b55-bb93-4f67-bb83-00b2b1473aad

cc: @timolegros

mzparacha commented 1 month ago

RCA: The is_welcome_onboard_flow_complete boolean is not returning true from API when it should, this is set as true whenever the user updates a profile with a proper username (that is not falsy/nullish or Anonymous).

@Rotorsoft did some refactoring to profiles in https://github.com/hicommonwealth/commonwealth/pull/8574 which already fixed this issue.

Releasing https://github.com/hicommonwealth/commonwealth/pull/8574 would be a fix (if its ready) or we could apply necessary changes separately, whatever is preferred.

cc: @jnaviask @ForestMars @timolegros @Rotorsoft

timolegros commented 1 month ago

RCA: The is_welcome_onboard_flow_complete boolean is not returning true from API when it should, this is set as true whenever the user updates a profile with a proper username (that is not falsy/nullish or Anonymous).

@Rotorsoft did some refactoring to profiles in #8574 which already fixed this issue.

Releasing #8574 would be a fix (if its ready) or we could apply necessary changes separately, whatever is preferred.

cc: @jnaviask @ForestMars @timolegros @Rotorsoft

@mzparacha are you sure? I was testing on a branch that already had #8574 merged and I was still getting the same issue...

timolegros commented 1 month ago

Alright, so @mzparacha clarified the situation. With Rogers #8574 PR the issue is resolved but users will still need to complete the onboarding flow once (it will not re-appear on the next sign-in). To further improve the experience we can create a migration which sets the User.is_welcome_onboard_flow_complete boolean column to true if the user already has a defined and non-anonymous User.profile ->> name.

The issue I initially described in this comment is a separate bug that will be handled in #8653.