p2-inc / phasetwo-admin-portal

https://phasetwo.io
Other
19 stars 14 forks source link

:bug: wrong condition for username same as email #131

Closed MGLL closed 7 months ago

MGLL commented 8 months ago

Hi,

During some testing, I have noticed that when I set registrationEmailAsUsername: true

I was getting this behaviour: image

And when I set registrationEmailAsUsername: false

I was getting this behaviour: image

I was able to reproduce it with a container by playing with the Realm Settings -> Email as username toggle.


Now with this fix, when I set registrationEmailAsUsername: false

I get the expected behaviour: image

MGLL commented 8 months ago

I saw after the PR that you had some discussion around this area (related to profile metadata and account v3).

I assumed it was a bug as it gives an unexpected behaviour to my eyes (with the "Email as username" to true, I had both username and email fields and I was wondering why the email input was empty and blocking the update of firstname or lastname).

So I will let you both check that if it was indeed a "bug".

Best

MGLL commented 8 months ago

Actually, I think I would like to open a discussion on it. Because I noticed, if we set "email as username", it's actually the username which is used in the user-profile. But actually, it should be the email.

Also, I have noticed that email doesn't update, even with this configuration:

I have noticed that in keycloak account now email can be updated with: image Because it seems that by default, the email is readOnly in Keycloak.

EDIT: Found a configuration where I can update email through account directly without update email flow, but not from admin portal. I will try to dig a bit deeper into the why.

pnzrr commented 7 months ago

@MGLL Your fix does make sense for the logic of which inputs to edit.

There are some issues with which fields are being updated based on what is set. I'm addressing that now in a separate PR.