Skip to content

Commit

Permalink
Hide update password form for guest users
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenWeathers committed Apr 11, 2023
1 parent cf30fe2 commit d755f8e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions e2e/tests/profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ test.describe('User Profile page', () => {
await expect(
profilePage.page.locator('[data-testid="request-verify"]'),
).not.toBeVisible()

await expect(
profilePage.page.locator('[data-testid="toggle-updatepassword"]'),
).not.toBeVisible()
})

test('Guest user cannot create API keys', async ({guestPage}) => {
Expand Down Expand Up @@ -67,6 +71,10 @@ test.describe('User Profile page', () => {
await expect(
profilePage.page.locator('[data-testid="request-verify"]'),
).toBeVisible()

await expect(
profilePage.page.locator('[data-testid="toggle-updatepassword"]'),
).toBeVisible()
})

test('Registered non verified user cannot create API keys', async ({
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/user/ProfileForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,13 @@

<div>
<div class="ltr:text-right rtl:text-left">
{#if !ldapEnabled && !headerAuthEnabled && toggleUpdatePassword}
{#if !ldapEnabled && !headerAuthEnabled && profile.rank !== 'GUEST' && toggleUpdatePassword}
<button
type="button"
class="inline-block align-baseline font-bold
text-sm text-blue-500 hover:text-blue-800 rtl:ml-4 ltr:mr-4"
on:click="{toggleUpdatePassword}"
data-testid="toggle-updatepassword"
>
{$_('pages.warriorProfile.updatePasswordButton')}
</button>
Expand Down

0 comments on commit d755f8e

Please sign in to comment.