diff --git a/app/components/profile-field.hbs b/app/components/profile-field.hbs index e1c00879..ca4060e5 100644 --- a/app/components/profile-field.hbs +++ b/app/components/profile-field.hbs @@ -10,6 +10,7 @@ placeholder={{@placeholder}} class="profile-field-input" required={{@required}} + disabled={{@isDeveloper}} {{on 'input' (fn this.inputFieldChanged)}} {{on 'blur' (fn this.checkInputValidation)}} /> diff --git a/app/routes/profile.js b/app/routes/profile.js index 45527b20..7254d6ce 100644 --- a/app/routes/profile.js +++ b/app/routes/profile.js @@ -8,6 +8,10 @@ export default class ProfileRoute extends Route { @service toast; async model() { try { + const res = await fetch(`${ENV.BASE_API_URL}/users/isDeveloper`, { + credentials: 'include', + }); + const { developerRoleExistsOnUser } = await res.json(); const response = await fetch(`${ENV.BASE_API_URL}/users/self`, { credentials: 'include', }); @@ -15,6 +19,7 @@ export default class ProfileRoute extends Route { if (response.status === 401) { throw new Error('You are not logged in. Please login to continue.'); } + userData.isDeveloper = developerRoleExistsOnUser; return userData; } catch (error) { console.error(error.message); diff --git a/app/styles/profile.css b/app/styles/profile.css index 9178b7ac..f518b6b6 100644 --- a/app/styles/profile.css +++ b/app/styles/profile.css @@ -39,6 +39,11 @@ border-color: var(--profile-input-outline-clr); } +.profile-page-error { + text-align: center; + color: red; +} + .profile-field-input { padding: 0 1.25rem; border: none; @@ -46,6 +51,12 @@ outline: none; } +.profile-field-input:disabled { + opacity: 0.6; + cursor: not-allowed; + pointer-events: none; +} + .profile-field-input:active { border-color: var(--profile-input-outline-clr); } diff --git a/app/templates/profile.hbs b/app/templates/profile.hbs index 88403f18..0132af9d 100644 --- a/app/templates/profile.hbs +++ b/app/templates/profile.hbs @@ -1,35 +1,58 @@ {{page-title 'Profile'}} -