# Hide / disable email changes on client account area

**URL:** <https://forum.keycloak.org/t/hide-disable-email-changes-on-client-account-area/2241>\
**Category:** Configuring the server\
**Created:** [April 20, 2020, 3:29pm UTC](https://forum.keycloak.org/t/hide-disable-email-changes-on-client-account-area/2241 "2020-04-20T15:29:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![h4xhor](https://avatars.discourse-cdn.com/v4/letter/h/13edae/32.png) [@h4xhor](https://forum.keycloak.org/u/h4xhor)\
**Post date:** [April 20, 2020, 3:29pm UTC](https://forum.keycloak.org/t/hide-disable-email-changes-on-client-account-area/2241/1 "2020-04-20T15:29:02Z")

</div>

Hi Keycloak community,

Does anyone know whether it’s possible to hide or disable the email changes when they log into their client account area and show the username instead?

For the realm in the “Login” settings I have:  
“Email as username” enabled  
“Login with email” disabled

So the username is used as the email and I’m not using the email field.

 ![userDashboard](https://global.discourse-cdn.com/free1/uploads/keycloak/original/1X/e36a3049ee46deae3941737b1840d20ee912f691.png)

Many thanks!

---

<div class="post-metadata">

**Author:** ![hauschka](https://avatars.discourse-cdn.com/v4/letter/h/e9c0ed/32.png) [@hauschka](https://forum.keycloak.org/u/hauschka)\
**Post date:** [October 11, 2020, 6:50pm UTC](https://forum.keycloak.org/t/hide-disable-email-changes-on-client-account-area/2241/2 "2020-10-11T18:50:12Z")

</div>

Did you ever find out how to disable email changes?

I’m wondering the same right now.

---

<div class="post-metadata">

**Author:** ![dcr31000](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@dcr31000](https://forum.keycloak.org/u/dcr31000)\
**Post date:** [October 13, 2020, 12:29pm UTC](https://forum.keycloak.org/t/hide-disable-email-changes-on-client-account-area/2241/3 "2020-10-13T12:29:17Z")

</div>

Same problem here.  
Keycloak version 11.0.2 (and previous).

I’ve set “Email as usename” enabled and “edit username” disabled but when I go to client account area I can edit email (so can edit username).

How can I disable email changes ? Thanks

---

<div class="post-metadata">

**Author:** ![dasniko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dasniko/32/2969_2.png) [@dasniko](https://forum.keycloak.org/u/dasniko)\
**Post date:** [October 14, 2020, 8:15am UTC](https://forum.keycloak.org/t/hide-disable-email-changes-on-client-account-area/2241/4 "2020-10-14T08:15:58Z")

</div>

It’s like the expression says: use email as username, not vise-versa.  
So, the email address is used as username, thus the username ist not visible.  
The option “edit username” yields only to username, not email. If the username field is not visible in the UI, it has no effect.  
Email changes can’t be disabled.  
(Exception: you make the field read-only in your customized theme).

---

<div class="post-metadata">

**Author:** ![dcr31000](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@dcr31000](https://forum.keycloak.org/u/dcr31000)\
**Post date:** [October 14, 2020, 11:13am UTC](https://forum.keycloak.org/t/hide-disable-email-changes-on-client-account-area/2241/5 "2020-10-14T11:13:13Z")

</div>

@dasniko, ok, but user can change its email in account page and this will change also username. I don’t want to allow username changes and the field “edit username” is disabled…

---

<div class="post-metadata">

**Author:** ![dasniko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dasniko/32/2969_2.png) [@dasniko](https://forum.keycloak.org/u/dasniko)\
**Post date:** [October 14, 2020, 11:19am UTC](https://forum.keycloak.org/t/hide-disable-email-changes-on-client-account-area/2241/6 "2020-10-14T11:19:32Z")

</div>

If you use email as username and users are allowed to edit their email address - why should username change be forbidden? That doesn’t make sense at all.  
When a user changes its email address with which it logs in, it wouldn’t expect that there is still the old email address somewhere available with which is also a login possible.  
If you need an immutable date, use the userid, this won’t change.

---

<div class="post-metadata">

**Author:** ![dcr31000](https://avatars.discourse-cdn.com/v4/letter/d/e19adc/32.png) [@dcr31000](https://forum.keycloak.org/u/dcr31000)\
**Post date:** [October 14, 2020, 11:32am UTC](https://forum.keycloak.org/t/hide-disable-email-changes-on-client-account-area/2241/7 "2020-10-14T11:32:33Z")

</div>

@dasniko, I want to set email immutable because email is used to match account in some (bad?) OIDC/SAML adapters. So yes, I use email as username and don’t want to allow user to edit their email address.

---

<div class="post-metadata">

**Author:** ![dasniko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dasniko/32/2969_2.png) [@dasniko](https://forum.keycloak.org/u/dasniko)\
**Post date:** [October 14, 2020, 12:02pm UTC](https://forum.keycloak.org/t/hide-disable-email-changes-on-client-account-area/2241/8 "2020-10-14T12:02:09Z")

</div>

Then set the field to readonly in your custom account theme. This way, users won’t be able to edit their email-address.

---

<div class="post-metadata">

**Author:** ![macakraca](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/macakraca/32/2070_2.png) [@macakraca](https://forum.keycloak.org/u/macakraca)\
**Post date:** [March 31, 2021, 11:59am UTC](https://forum.keycloak.org/t/hide-disable-email-changes-on-client-account-area/2241/9 "2021-03-31T11:59:17Z")

</div>

This front-end hack is problematic from security standpoint. Email should be immutable in the backend.

---

<div class="post-metadata">

**Author:** ![liam](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/liam/32/2854_2.png) [@liam](https://forum.keycloak.org/u/liam)\
**Post date:** [April 13, 2021, 10:16pm UTC](https://forum.keycloak.org/t/hide-disable-email-changes-on-client-account-area/2241/10 "2021-04-13T22:16:19Z")

</div>

Yeah this is very problematic, especially since Keycloak doesn’t make the user to verify the email after they change it (and there’s no way to enable this flow from what I’ve seen). It essentially makes email verification irrelevant for any user who can access the Account page. It seems like a pretty significant security oversight, and I don’t think changing the field to read only in the UI is enough.

---

<div class="post-metadata">

**Author:** ![wweber](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/wweber/32/3501_2.png) [@wweber](https://forum.keycloak.org/u/wweber)\
**Post date:** [July 8, 2021, 2:44pm UTC](https://forum.keycloak.org/t/hide-disable-email-changes-on-client-account-area/2241/11 "2021-07-08T14:44:15Z")

</div>

For anyone finding this thread later on, as of at least version 14, setting “email as username” and disabling editable usernames does in fact prevent users from changing their email address. The UX for this in the default templates is not great however, it still renders an editable form field but will reject an edit with “Bad Request: readOnlyUsernameMessage”

If you want to make other fields read-only, you might want to check out enabling the Declarative User Profile feature ([Server Administration Guide](https://www.keycloak.org/docs/latest/server_admin/#enabling-the-declarative-user-profile)) which allows you to set e.g. firstName and lastName as read-only (but still set on registration). It is important to note that this does NOT work with the “email” field.

If you wish to disable email changing due to the fact that Keycloak does not currently require verification for the new email, watch this PR [KEYCLOAK-6455 Ability to require email to be verified before changing by reda-alaoui · Pull Request #7943 · keycloak/keycloak · GitHub](https://github.com/keycloak/keycloak/pull/7943)
